I have tired to below code and variable with JMeter Groovy WebDriver Sampler. It's not working and return the Response Code 500 "ElementNotInteractableException: element not interactable". But I hard code the variable name and working find. The problem of XML variable is Dynamic and the numbers will be changed for every time loading from the Chrome. Can you please advise?
Variable not working:
WDS.browser.findElement(org.openqa.selenium.By.xpath("//ul[contains(@id,'dropdown-menu-')]/li")).click();
Variable working fine:
WDS.browser.findElement(org.openqa.selenium.By.xpath("//ul[@id='dropdown-menu-2724']/li")).click();
I also tried with below codes but didn't work.
WDS.browser.findElement(org.openqa.selenium.By.xpath("//ul[contains(@id,'dropdown-menu-')]/li")).sendKeys("dropdown-menu-");
WDS.browser.findElement(org.openqa.selenium.By.xpath("//ul[starts-with(@id,'dropdown-menu-')]/li")).sendKeys("dropdown-menu-");
below codes also don't work:
WDS.browser.findElement(org.openqa.selenium.By.id("dropdown-menu-").sendKeys("dropdown-menu-"));
WDS.browser.findElement(org.openqa.selenium.By.id("dropdown-menu-").sendKeys(Keys.ENTER));
enter image description here
enter image description here
enter image description here
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…