【发布时间】:2015-09-09 23:13:52
【问题描述】:
在将 Chromedriver 与 Selenium 一起使用时,我遇到了以下可怕的错误:
"org.openqa.selenium.WebDriverException: Element is not clickable at point (xxx, yyy). Other element would receive the click: ..."
我知道这已经讨论过here
但是,如果我延迟大约 5 秒然后单击它,我的情况会有所不同。我不需要做任何特别的事情,请稍等。
我知道我可以通过使用 JS 或 Actions 来强制点击,但我想要一种更优雅的处理方式,即仅在按钮变为可点击时点击按钮。问题是我不知道如何检查按钮是否可点击。
我尝试了以下方法,但都不起作用:
1) ExpectedConditions.elementToBeClickable
2) ExpectedConditions.visibilityOf
有什么想法吗?
【问题讨论】:
-
我想我可以编写一个方法来不断尝试点击,直到它成功点击,即延迟尝试/捕获?这会被认为是一个优雅的解决方案吗?我讨厌必须把 thread.sleeps 放在任何地方。
标签: java selenium selenium-chromedriver