我正在使用Selenium 2 Java API和FirefoxDriver.当我填写表单时,根据表单输入将复选框添加到页面.
我想使用Selenium模拟这些复选框的点击.该元素在常规浏览器中可见并可用,但selenium断言元素不可见.
"Element is not currently visible and so may not be interacted with"
Run Code Online (Sandbox Code Playgroud)
我可以强制硒忽略元素的不可见状态吗?如何强制Selenium与不可见元素进行交互?
我有一个HTML href链接
<a href="/docs/configuration">App Configuration</a>
Run Code Online (Sandbox Code Playgroud)
使用Selenium我需要点击链接.目前,我使用下面的代码 -
Driver.findElement(By.xpath("//a[text()='App Configuration']")).click();
Run Code Online (Sandbox Code Playgroud)
但它没有重定向到页面.我也试过下面的代码 -
Driver.findElement(By.xpath(//a[@href ='/docs/configuration']")).click();
Run Code Online (Sandbox Code Playgroud)
但这是抛出异常 -
org.openqa.selenium.ElementNotVisibleException:元素当前不可见,因此可能无法与命令持续时间或超时交互:13毫秒
链接可见,页面已完全加载.我不知道我的代码有什么问题.