selenium dynamically click li item
I ended up doing this:
Modified the selector to make sure ONLY the expected elements are returned. It helps a lot in terms of execution time and reducing the number of unwanted loopings. And, then find the element in run time and use Action()
on that to perform double click. I also update the Selenium
binding as @alecxe suggested to work with latest Firefox
public void DemoTest() throws InterruptedException { List<WebElement> liItems = driver.findElements(By.xpath("//*[contains(text(),'initially open')]")); for(WebElement liItem:liItems) { Actions actions = new Actions(driver); actions.moveToElement(liItem).doubleClick().build().perform(); } }