# Select item List

**URL:** <https://forum.katalon.com/t/select-item-list/55955>\
**Category:** Web Testing\
**Tags:** katalon-studio\
**Created:** [June 22, 2021, 9:25am UTC](https://forum.katalon.com/t/select-item-list/55955 "2021-06-22T09:25:49Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![ferrariklersone](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/ferrariklersone/32/15706_2.png) [@ferrariklersone](https://forum.katalon.com/u/ferrariklersone)\
**Post date:** [June 22, 2021, 9:25am UTC](https://forum.katalon.com/t/select-item-list/55955/1 "2021-06-22T09:25:49Z")

</div>

hello,  
@kazurayam @Russ_Thomas

i want to select one item in this dropdown list and i’m facing the error.

so i have tried select by (index, label, value) it does not work in the the classic method.

thank you for helping dears 🙃

UI:

 ![image](https://europe1.discourse-cdn.com/katalon/original/3X/d/f/dfa150576ba467dc1cadb6ee7665077f15c3afc9.png)

html code :

 ![image](https://europe1.discourse-cdn.com/katalon/original/3X/7/b/7ba621442b804893e0d0bbcdc1a99a059b401b48.png)

script katalon:

 ![image](https://europe1.discourse-cdn.com/katalon/original/3X/c/0/c08e9a9c73f2917e9929d93ea63b56dd29257e96.png)

error :

 ![image](https://europe1.discourse-cdn.com/katalon/original/3X/c/e/ce424a96dd96edae43996df0aa684c47d707f4a8.png)

---

<div class="post-metadata">

**Author:** ![Russ\_Thomas](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/russ_thomas/32/11884_2.png) [@Russ\_Thomas](https://forum.katalon.com/u/Russ_Thomas)\
**Post date:** [June 22, 2021, 2:04pm UTC](https://forum.katalon.com/t/select-item-list/55955/2 "2021-06-22T14:04:44Z")

</div>

Your problem is this…

The `<select>` element is a hidden control (`style=display:none`). The application is hiding that control to present the same data using different HTML elements (probably a div element with span child elements). When you try to use `selectElementBy*`, the API is expecting to see a `<select>` element but you are providing the `<span>` element.

In short, you can’t use any of the `selectElementBy*` APIs. You need to use something else and, _if needed_, adjust your selectors accordingly.

---

<div class="post-metadata">

**Author:** ![ferrariklersone](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/ferrariklersone/32/15706_2.png) [@ferrariklersone](https://forum.katalon.com/u/ferrariklersone)\
**Post date:** [June 22, 2021, 2:09pm UTC](https://forum.katalon.com/t/select-item-list/55955/3 "2021-06-22T14:09:52Z")

</div>

@Russ_Thomas thank you very much for this observation.  
I have tried some methods, but nothing works.  
any suggestion so that i skip this step, which has been blocking me since 11 am.

🙃

---

<div class="post-metadata">

**Author:** ![Russ\_Thomas](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/russ_thomas/32/11884_2.png) [@Russ\_Thomas](https://forum.katalon.com/u/Russ_Thomas)\
**Post date:** [June 22, 2021, 2:12pm UTC](https://forum.katalon.com/t/select-item-list/55955/4 "2021-06-22T14:12:02Z")

</div>

Simply put, you probably need to `WebUI.click()` the element directly. Try the same Text Object (i.e. the span).

---

<div class="post-metadata">

**Author:** ![ferrariklersone](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/ferrariklersone/32/15706_2.png) [@ferrariklersone](https://forum.katalon.com/u/ferrariklersone)\
**Post date:** [June 22, 2021, 2:18pm UTC](https://forum.katalon.com/t/select-item-list/55955/5 "2021-06-22T14:18:21Z")

</div>

the first click displays the list of items.  
how to make the second click to select item?  
i tried to capture an item with spy web, but it does not capture.

---

<div class="post-metadata">

**Author:** ![Russ\_Thomas](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/russ_thomas/32/11884_2.png) [@Russ\_Thomas](https://forum.katalon.com/u/Russ_Thomas)\
**Post date:** [June 22, 2021, 2:27pm UTC](https://forum.katalon.com/t/select-item-list/55955/6 "2021-06-22T14:27:22Z")

</div>

I need to see the HTML for the first screenshot…

 ![](https://europe1.discourse-cdn.com/katalon/uploads/default/uploads/default/original/3X/d/f/dfa150576ba467dc1cadb6ee7665077f15c3afc9.png)

The HTML you posted is for the hidden select element.

---

<div class="post-metadata">

**Author:** ![ferrariklersone](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/ferrariklersone/32/15706_2.png) [@ferrariklersone](https://forum.katalon.com/u/ferrariklersone)\
**Post date:** [June 22, 2021, 2:30pm UTC](https://forum.katalon.com/t/select-item-list/55955/7 "2021-06-22T14:30:34Z")

</div>

it’s the same HTML, i didn’t change it just crossed out the information

---

<div class="post-metadata">

**Author:** ![Brandon\_Hein](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/brandon_hein/32/1092_2.png) [@Brandon\_Hein](https://forum.katalon.com/u/Brandon_Hein)\
**Post date:** [June 22, 2021, 3:03pm UTC](https://forum.katalon.com/t/select-item-list/55955/8 "2021-06-22T15:03:34Z")

</div>

If you’re open to it, try using pure Selenium. You can get around element visibility pretty easily. A couple of ideas:

1.) Use the Select class:

```
WebElement element = WebUiCommonHelper.findWebElement(By.xpath("//select[@id='ct10_CONTENU_PAGE_DemandeComp_listeEntite']"), 30)
Select select = new Select(element)
// select by index, value, visible text, etc.:
select.selectByIndex(1)
select.selectByValue(13)
select.selectByVisibleText("...(AOF)")

```

2.) Send the value as keys to the `<select>` element (or an `<input>` element for the field, if it exists, which it looks like it might based on your screenshot, which has a search box). You then send a `Keys.ENTER` to set the field with the value you sent:

```
WebElement element = WebUiCommonHelper.findWebElement(By.xpath("//select[@id='ct10_CONTENU_PAGE_DemandeComp_listeEntite']"), 30)
element.sendKeys("...(AOF)")
element.sendKeys(Keys.ENTER)
```

---

<div class="post-metadata">

**Author:** ![ferrariklersone](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/ferrariklersone/32/15706_2.png) [@ferrariklersone](https://forum.katalon.com/u/ferrariklersone)\
**Post date:** [June 22, 2021, 3:18pm UTC](https://forum.katalon.com/t/select-item-list/55955/9 "2021-06-22T15:18:14Z")

</div>

Please what is the package i have to import ?  
because when i run the test, even the browser not opened.

---

<div class="post-metadata">

**Author:** ![Brandon\_Hein](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/brandon_hein/32/1092_2.png) [@Brandon\_Hein](https://forum.katalon.com/u/Brandon_Hein)\
**Post date:** [June 22, 2021, 3:18pm UTC](https://forum.katalon.com/t/select-item-list/55955/10 "2021-06-22T15:18:39Z")

</div>

Press `ctrl + shift + o` on your keyboard.

---

<div class="post-metadata">

**Author:** ![ferrariklersone](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/ferrariklersone/32/15706_2.png) [@ferrariklersone](https://forum.katalon.com/u/ferrariklersone)\
**Post date:** [June 22, 2021, 3:24pm UTC](https://forum.katalon.com/t/select-item-list/55955/11 "2021-06-22T15:24:20Z")

</div>

script :

 ![image](https://europe1.discourse-cdn.com/katalon/original/3X/0/9/096ef12c52785677253299531bb1771e0244b987.png)

error :

 ![image](https://europe1.discourse-cdn.com/katalon/original/3X/e/c/ec50b66b40bd92e041cf5cae8c6cae1684c333e9.png)

---

<div class="post-metadata">

**Author:** ![Brandon\_Hein](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/brandon_hein/32/1092_2.png) [@Brandon\_Hein](https://forum.katalon.com/u/Brandon_Hein)\
**Post date:** [June 22, 2021, 3:28pm UTC](https://forum.katalon.com/t/select-item-list/55955/12 "2021-06-22T15:28:04Z")

</div>

Ah that’s right, it wants a stupid Test Object. I assume you have a Test Object already defined for that `<select>` element. If that’s true, then change the WebUiCommonHelper call to this:

`WebElement element = WebUiCommonHelper.findWebElement(findTestObject("path/to/my/test/object"), 30)`

or else, we could also use pure selenium:

`WebElement element = DriverFactory.getWebDriver().findElement(By.xpath("//select[@id='ct10_CONTENU_PAGE_DemandeComp_listeEntite']"))`

sorry, I haven’t been using Katalon for a while now…

---

<div class="post-metadata">

**Author:** ![ferrariklersone](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/ferrariklersone/32/15706_2.png) [@ferrariklersone](https://forum.katalon.com/u/ferrariklersone)\
**Post date:** [June 22, 2021, 3:47pm UTC](https://forum.katalon.com/t/select-item-list/55955/13 "2021-06-22T15:47:25Z")

</div>

i don’t know what’s wrong again.

 ![image](https://europe1.discourse-cdn.com/katalon/original/3X/1/3/1350a29ceab19b5f53e4bf029cb982bcadb0687d.png)

 ![image](https://europe1.discourse-cdn.com/katalon/original/3X/c/5/c53996f520d0af2ba3849f229c8bda26ec5bd92f.png)

---

<div class="post-metadata">

**Author:** ![Brandon\_Hein](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/brandon_hein/32/1092_2.png) [@Brandon\_Hein](https://forum.katalon.com/u/Brandon_Hein)\
**Post date:** [June 22, 2021, 3:48pm UTC](https://forum.katalon.com/t/select-item-list/55955/14 "2021-06-22T15:48:23Z")

</div>

Can you share your Test Object for the element?

---

<div class="post-metadata">

**Author:** ![ferrariklersone](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/ferrariklersone/32/15706_2.png) [@ferrariklersone](https://forum.katalon.com/u/ferrariklersone)\
**Post date:** [June 22, 2021, 4:55pm UTC](https://forum.katalon.com/t/select-item-list/55955/15 "2021-06-22T16:55:47Z")

</div>

![image](https://europe1.discourse-cdn.com/katalon/original/3X/5/4/546e21c3bd1d3aca163c1bcc5615c11f84410dd9.png)

---

<div class="post-metadata">

**Author:** ![Brandon\_Hein](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/brandon_hein/32/1092_2.png) [@Brandon\_Hein](https://forum.katalon.com/u/Brandon_Hein)\
**Post date:** [June 22, 2021, 6:01pm UTC](https://forum.katalon.com/t/select-item-list/55955/17 "2021-06-22T18:01:44Z")

</div>

Ok, your problem here (and I think your problem originally) is that you are not targeting the `<select>` element, but rather some `<span>` element, like @Russ_Thomas mentioned above:

> [@Russ\_Thomas](#):
>
> When you try to use `selectElementBy*` , the API is expecting to see a `<select>` element but you are providing the `<span>` element.

The Katalon (and, by extension, the Selenium) selectBy\_\_\_() methods do not recognize `<span>`s, only `<select>`s.

In your test object, set the “Selection Method” to “Attributes”, and create a custom locator of type xpath with the following value:

`//select[@id='ct10_CONTENU_PAGE_DemandeComp_listeEntite']`

(Note: make sure you check the “Locate by” checkbox for the locator)

Then rerun your script.

---

<div class="post-metadata">

**Author:** ![Russ\_Thomas](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/russ_thomas/32/11884_2.png) [@Russ\_Thomas](https://forum.katalon.com/u/Russ_Thomas)\
**Post date:** [June 22, 2021, 6:34pm UTC](https://forum.katalon.com/t/select-item-list/55955/18 "2021-06-22T18:34:48Z")

</div>

The trick here, and the solution, is finding the correct form of words that will traverse the language barrier. None of which is the OP’s fault, but it’s a problem that rears its ugly head all too frequently.

@ferrariklersone Read my post again. Read @Brandon_Hein’s last post again. Everything you need is in there.

Good luck.

---

<div class="post-metadata">

**Author:** ![ferrariklersone](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/ferrariklersone/32/15706_2.png) [@ferrariklersone](https://forum.katalon.com/u/ferrariklersone)\
**Post date:** [June 24, 2021, 8:48am UTC](https://forum.katalon.com/t/select-item-list/55955/19 "2021-06-24T08:48:01Z")

</div>

Thank you @Russ_Thomas @Brandon_Hein @grylion54  
I applied your advice and followed your comments to the letter, and I was able to click on an item on the list.  
legal notice to you ✌
