/**显示等待并返回元素 * @param driver * @param locator */ public static WebElement showWait(WebDriver driver, final String locator) { return new WebDriverWait(driver, 10).until(new ExpectedCondition<WebElement>() { public WebElement apply(WebDriver d) { return d.findElement(By.id(locator)); } }); } /**隐式等待 * @param driver */ public static void implicitWait(WebDriver driver) { driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); }