请仔细阅读此堆栈溢出答案以更好地理解。
更新 我们也可以尝试
There are many Conditions that we can use withing Webdriver tests.1. visibilityOf(WebElement element) : An expectation for checking that an element, known to be present on the DOM of a page, is visible.2. visibilityOfElementLocated(By locator) : An expectation for checking that an element is present on the DOM of a page and visible.In the above two conditions we are waiting for an element to be present on the DOM of a page and also visible. These works fine only when the element is loaded completely.
也请尝试如下
尝试使用Y坐标单击
WebElement elementToClick = driver.findElement(By.xpath("Your xpath"));// Scroll the browser to the element's Y position((JavascriptExecutor)driver).executescript("window.scrollTo(0,"+elementToClick.getLocation().y+")");// Click the elementelementToClick.click();尝试使用X坐标单击
WebElement elementToClick = driver.findElement(By.xpath("Your xpath"));// Scroll the browser to the element's X position((JavascriptExecutor)driver).executescript("window.scrollTo(0,"+elementToClick.getLocation().x+")");// Click the elementelementToClick.click();希望这对您有帮助



