(1) new WebDriverWait(driver, 10). until(ExpectedConditions.elementToBeClickable(locator));
(2) new WebDriverWait(driver, 10). until(ExpectedConditions.visibilityOf(locator));
(3) new WebDriverWait(driver, 10). until(ExpectedConditions.presenceOfElementLocated(locator);
(4)
Function<WebDriver, WebElement> waitFn = new Function<WebDriver, WebElement>() {
@Override
public WebElement apply(WebDriver driver) {
return el.findElement(By.cssSelector("div.rptstatus.rptcomplete"));
}
};
//Detect every 2 seconds, the maximum time is 120 seconds
WebDriverWait wait = new WebDriverWait(driver, 120, 2);
wait.withMessage("A processing icon should display in the Status column in the row.”)
wait.until(waitFn);
时间: 2024-10-08 20:14:44