我正在使用 selenium webdriver 和 chrome 驱动程序。 我的问题是:
页面中有一个 10 秒的计时器。计时器停止后我需要单击一个元素。当计时器运行时,该元素的位置是(960,508)
(这只是一个假设,因为当计时器运行时,不可能检查该元素)。当计时器停止时,元素会更改其位置,现在其位置为 (764,468)
。当我尝试单击此元素时,会显示错误消息:
"Element is not clickable at point (960, 508). Other element would receive the click"
我的问题是,计时器结束后,我能够将元素定位到位置(764,468)
。但我无法单击该元素,并且在错误消息中该位置显示为 (960,508)
。
最佳答案
使用下面的代码。这可能会有所帮助。如果它不起作用,请执行此 link.
WebDriverWait wait = new WebDriverWait(driver, 15);
WebElement element = wait.until(ExpectedConditions.elementToBeClickable(By.id("ID of the element")));
Actions actions = new Actions(driver);
actions.moveToElement(element).click().perform():
关于java - 元素不可点击,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28667960/