繁体   English   中英

如何使用 Java 在 Selenium WebDriver 中选择隐藏的下拉值

[英]How to select a hidden dropdown value in Selenium WebDriver using Java

我有一个在加载时隐藏的下拉列表,单击按钮将其设置为可见,当 selenium 在浏览器中运行它时我可以看到它,但它仍然给我这个异常

org.openqa.selenium.WebDriverException: ElementNotVisibleError: Element is not currently visible and may not be manipulated'ElementNotVisibleError: Element is not currently visible and may not be manipulated' when calling method: [wdIMouse::click] Command duration or timeout: 47 milliseconds

有人可以建议我们如何解决这个问题吗?

尝试使用ActionsWebDriverWait

也许像这样

Actions builder = new Actions(driver);
WebDriverWait wait = new WebDriverWait(driver);

Action clickTheDropDown = builder.moveToElement(dd).Click(otherElement).build();

clickTheDropDown.perform();
wait.Until(Expectedcondition.VisibilityOfElement(dd);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM