当我的Selenium脚本通过click()
方法单击网页上显示的链接元素时,我收到以下错误:
org.openqa.selenium.WebDriverException: Element is not clickable at point (36, 72).
这是我的 HTML 代码
<div id="targettab">
<a href="Default.aspx" id="highlight-book">Book</a>
</div>
这是我的硒代码:
driver.findElement(By.id("highlight-book")).click();
我在这里做错了什么?您能告诉我可能的解决方案吗?谢谢。
如果元素存在于许多嵌套的div 中,很少有硒驱动程序无法单击元素。您可以尝试使用"输入"按钮单击。
driver.findElement(By.id("highlight-book")).sendKeys(Keys.Return);