# Unable to click li item in dropdown

**URL:** <https://forum.katalon.com/t/unable-to-click-li-item-in-dropdown/48518>\
**Category:** Web Testing\
**Tags:** katalon-studio\
**Created:** [October 21, 2020, 9:35pm UTC](https://forum.katalon.com/t/unable-to-click-li-item-in-dropdown/48518 "2020-10-21T21:35:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![KCTorno](https://avatars.discourse-cdn.com/v4/letter/k/a6a055/32.png) [@KCTorno](https://forum.katalon.com/u/KCTorno)\
**Post date:** [October 21, 2020, 9:35pm UTC](https://forum.katalon.com/t/unable-to-click-li-item-in-dropdown/48518/1 "2020-10-21T21:35:41Z")

</div>

Hello!

So I have a dropdown like so:

 ![image](https://europe1.discourse-cdn.com/katalon/original/2X/1/19371ed66f30b76cbf69ca46fc6dd86d088d1201.png) which is a ul and li type list.  
 ![image](https://europe1.discourse-cdn.com/katalon/original/2X/9/93b545fa14c017b0674dc289c5d54037004be3e4.png)

this is my script portion which calls the above:

 ![image](https://europe1.discourse-cdn.com/katalon/original/2X/9/9d200d0c631567692c4b1900c187695b8abc76b5.png)

this is the li item xpath, which I verified in browser that exists and points to correct item in dropdown (if I populate the FromAccount variable with an existing item), I also tested it during a test, I added a 30s delay and found it no problem in devtools:

 ![image](https://europe1.discourse-cdn.com/katalon/original/2X/3/3bf6ae25dc05c801f9230d9d452615b657afa883.png)  
have also tried xpaths like this:  
 ![image](https://europe1.discourse-cdn.com/katalon/original/2X/6/627bdc01b89a4e8ca045d1d18bb2d7d4a22d01ea.png) for the li item

this is the element I click to open the dropdown which also clicks no problem:

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

But whenever I want it to say click on ‘test3’ it doesnt do anything, passes and presents no errors. I’ve tried javascript, long delays, wait methods, but nothing, anyone got any ideas?

Thanks!!

---

<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:** [October 21, 2020, 11:13pm UTC](https://forum.katalon.com/t/unable-to-click-li-item-in-dropdown/48518/2 "2020-10-21T23:13:57Z")

</div>

What about trying:

```auto
import org.openqa.selenium.WebDriver as WebDriver
import org.openqa.selenium.WebElement as WebElement
import com.kms.katalon.core.webui.driver.DriverFactory as DriverFactory

def driver = DriverFactory.getWebDriver();
WebElement pItem = driver.findElement(By.id('ui-id-4'));
pItem.click();

```

---

<div class="post-metadata">

**Author:** ![KCTorno](https://avatars.discourse-cdn.com/v4/letter/k/a6a055/32.png) [@KCTorno](https://forum.katalon.com/u/KCTorno)\
**Post date:** [October 21, 2020, 11:33pm UTC](https://forum.katalon.com/t/unable-to-click-li-item-in-dropdown/48518/3 "2020-10-21T23:33:42Z")

</div>

unfortunately I would need the element to be dynamic, if I wanted test2 for example that wouldnt work. this exact test with the same elements works no problem in my c# selenium project. Was hoping there was a way I could do this without a bunch of extra code. Has to be a reason why this isn’t working as intended, I just can’t see it ☹

---

<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:** [October 21, 2020, 11:42pm UTC](https://forum.katalon.com/t/unable-to-click-li-item-in-dropdown/48518/4 "2020-10-21T23:42:07Z")

</div>

You can replace the id, such as “ui-id-4”, by a String variable that references your specific element’s id. Similarly, you can replace the **By.id** with **By.xpath** if you should need that and create a String variable of the xpath.

---

<div class="post-metadata">

**Author:** ![KCTorno](https://avatars.discourse-cdn.com/v4/letter/k/a6a055/32.png) [@KCTorno](https://forum.katalon.com/u/KCTorno)\
**Post date:** [October 21, 2020, 11:50pm UTC](https://forum.katalon.com/t/unable-to-click-li-item-in-dropdown/48518/5 "2020-10-21T23:50:23Z")

</div>

right right, was hoping to not have to do that and use katalons built in stuff. Odd but in the end I’m trying to see how much can be done if someone with little programming experience were to write this exact test.
