Unable to click li item in dropdown

Hello!

So I have a dropdown like so:
image which is a ul and li type list.

this is my script portion which calls the above:

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
have also tried xpaths like this:
image for the li item

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

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!!

What about trying:

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();
1 Like

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 :frowning:

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.

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.