# Cannot select the item from dropdown list

**URL:** <https://forum.katalon.com/t/cannot-select-the-item-from-dropdown-list/81033>\
**Category:** Web Testing\
**Tags:** katalon-studio\
**Created:** [November 28, 2022, 9:00am UTC](https://forum.katalon.com/t/cannot-select-the-item-from-dropdown-list/81033 "2022-11-28T09:00:25Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![waqas](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/waqas/32/22773_2.png) [@waqas](https://forum.katalon.com/u/waqas)\
**Post date:** [November 28, 2022, 9:00am UTC](https://forum.katalon.com/t/cannot-select-the-item-from-dropdown-list/81033/1 "2022-11-28T09:00:25Z")

</div>

I have a dropdown for user-type.  
When I record the steps, I am selecting the 3rd item from the list.  
When I execute the test case, It is clicking on the dropdown item and dropdown menu is shown to me. But it is not selecting the item. and test case got failed.

---

<div class="post-metadata">

**Author:** ![grylion54](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/grylion54/32/16265_2.png) [@grylion54](https://forum.katalon.com/u/grylion54)\
**Post date:** [November 28, 2022, 4:40pm UTC](https://forum.katalon.com/t/cannot-select-the-item-from-dropdown-list/81033/2 "2022-11-28T16:40:52Z")

</div>

If you can, can you show us the HTML of the element to ensure it is a **select** tag for the drop-down list? Right click on the element and choose “Inspect” (do this twice).

---

<div class="post-metadata">

**Author:** ![waqas](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/waqas/32/22773_2.png) [@waqas](https://forum.katalon.com/u/waqas)\
**Post date:** [November 29, 2022, 9:33am UTC](https://forum.katalon.com/t/cannot-select-the-item-from-dropdown-list/81033/3 "2022-11-29T09:33:08Z")

</div>

Here is the html of the items

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

---

<div class="post-metadata">

**Author:** ![grylion54](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/grylion54/32/16265_2.png) [@grylion54](https://forum.katalon.com/u/grylion54)\
**Post date:** [November 29, 2022, 10:57pm UTC](https://forum.katalon.com/t/cannot-select-the-item-from-dropdown-list/81033/4 "2022-11-29T22:57:11Z")

</div>

It looks like the aria-label contains the list of items, and each item has an **id**. Make an object in the OR that has an xpath of:  
`id("rc_select_0_list_2")`

Then do a click on that element.

---

<div class="post-metadata">

**Author:** ![waqas](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/waqas/32/22773_2.png) [@waqas](https://forum.katalon.com/u/waqas)\
**Post date:** [November 30, 2022, 8:55am UTC](https://forum.katalon.com/t/cannot-select-the-item-from-dropdown-list/81033/5 "2022-11-30T08:55:51Z")

</div>

Thank you. I will try this

---

<div class="post-metadata">

**Author:** ![mwarren04011990](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/mwarren04011990/32/26024_2.png) [@mwarren04011990](https://forum.katalon.com/u/mwarren04011990)\
**Post date:** [December 21, 2022, 5:25am UTC](https://forum.katalon.com/t/cannot-select-the-item-from-dropdown-list/81033/6 "2022-12-21T05:25:49Z")

</div>

Make sure to click the dropdown button first!

For example:

```auto
public final class GeneralWebUIUtils { 
	public static void HandleDropdown(TestObject dropdownButton, TestObject dropdownSelection) { 
		WebUI.click(dropdownButton);

		WebUI.waitForElementVisible(dropdownSelection, 2);
		WebUI.click(dropdownSelection);
		WebUI.waitForElementNotVisible(dropdownSelection, 2);
	}
}

```

Save that to a Keyword, then call it from your Test Case like so:

```auto
GeneralWebUIUtils.HandleDropdown(roleDropdownBtn, // make Test Object for this
	findTestObject("Your Users Page/Add User Modal/Role Dropdown/Manager Dropdown selection"));

```

after doing the following:

- create some role dropdown button in the Object Repository (I cannot see the HTML for it in your screenshot)
- create some test object for the dropdown selection, call it `"Your Users Page/Add User Modal/Role Dropdown/Manager Dropdown selection"` (or something similar), and use the xpath `//div[@aria-label = 'Moderator']` .

That would be how I approach this

---

<div class="post-metadata">

**Author:** ![robert.bonacic](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/robert.bonacic/32/23869_2.png) [@robert.bonacic](https://forum.katalon.com/u/robert.bonacic)\
**Post date:** [November 3, 2023, 6:12pm UTC](https://forum.katalon.com/t/cannot-select-the-item-from-dropdown-list/81033/7 "2023-11-03T18:12:19Z")

</div>

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