WebDriver 页面等待

selenium2.4.0版本提供了页面等待处理。

显示等待元素可见:

 protected void WaitElementVisible(By by,int timeOutInSeconds,
long pollingInterval) {
WebDriverWait wait = new WebDriverWait(driver, timeOutInSeconds);
wait.pollingEvery(pollingInterval, TimeUnit.MILLISECONDS);
wait.withMessage(String.format("Timeout waiting for element: %s", locator));
wait.until(ExpectedConditions.visibilityOfElementLocated(by));
}

隐式等待:

 protected void Waitfor(By by,int timeOutInSeconds,
long pollingInterval) {
driver.manage().timeouts().implicitlyWait(timeOutInSeconds, TimeUnit.SECONDS);
}
上一篇:关于SqlParameter中IN子句查询的问题


下一篇:[转]js来弹出窗口的详细说明