使用WebDriverWait条件。
WebDriverWait wait = new WebDriverWait(yourWebDriver, 5); wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//xpath_to_element")));Webdriver将等待5秒钟,以便您可以单击您的元素。

使用WebDriverWait条件。
WebDriverWait wait = new WebDriverWait(yourWebDriver, 5); wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//xpath_to_element")));Webdriver将等待5秒钟,以便您可以单击您的元素。