package Page;
import org.openqa.selenium.*;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
public class element {
private static WebElement element = null;
// 等待判断
public static boolean isExistWebElement(WebDriver driver, String xpath) {
// WebDriverWait wait = new WebDriverWait(driver, 2);
try {
WebDriverWait wait = new WebDriverWait(driver, 2);
wait.until(ExpectedConditions.presenceOfElementLocated(By
.xpath(xpath)));
return true;
} catch (Exception e) {
return false;
}
}
}