本文整理了Java中org.openqa.selenium.support.ui.WebDriverWait.withTimeout()
方法的一些代码示例,展示了WebDriverWait.withTimeout()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebDriverWait.withTimeout()
方法的具体详情如下:
包路径:org.openqa.selenium.support.ui.WebDriverWait
类名称:WebDriverWait
方法名:withTimeout
暂无
代码示例来源:origin: arquillian/arquillian-graphene
@Override
public FluentWait<WebDriver, FLUENT> withTimeout(long duration, TimeUnit unit) {
wait.withTimeout(duration, unit);
return this;
}
代码示例来源:origin: org.jboss.arquillian.graphene/graphene-webdriver-impl
@Override
public FluentWait<WebDriver, FLUENT> withTimeout(long duration, TimeUnit unit) {
wait.withTimeout(duration, unit);
return this;
}
代码示例来源:origin: EnMasseProject/enmasse
private boolean waitUntilLoginPage() {
try {
selenium.getDriverWait().withTimeout(Duration.ofSeconds(3)).until(ExpectedConditions.titleContains("Login"));
return true;
} catch (Exception ex) {
return false;
}
}
代码示例来源:origin: EnMasseProject/enmasse
@Override
public void checkReachableWebPage() {
String pageTitle = "Log";
selenium.getDriverWait().withTimeout(Duration.ofSeconds(60)).until(ExpectedConditions.titleContains(pageTitle));
}
}
代码示例来源:origin: fhoeben/hsac-fitnesse-fixtures
/**
* Executes condition until it returns a value other than null or false.
* It does not forward StaleElementReferenceExceptions, but keeps waiting.
* @param maxSecondsToWait number of seconds to wait at most.
* @param condition condition to check.
* @param <T> return type.
* @return result of condition (if not null).
* @throws TimeoutException when condition did not give a value to return after maxSecondsToWait.
*/
public <T> T waitUntil(int maxSecondsToWait, ExpectedCondition<T> condition) {
ExpectedCondition<T> cHandlingStale = getConditionIgnoringStaleElement(condition);
FluentWait<WebDriver> wait = waitDriver().withTimeout(Duration.ofSeconds(maxSecondsToWait));
return wait.until(cHandlingStale);
}
代码示例来源:origin: EnMasseProject/enmasse
@Override
public void checkReachableWebPage() {
selenium.getDriverWait().withTimeout(Duration.ofSeconds(60)).until(ExpectedConditions.presenceOfElementLocated(By.className("nav-pf-vertical")));
}
}
代码示例来源:origin: EnMasseProject/enmasse
@Override
public void checkReachableWebPage() {
selenium.getDriverWait().withTimeout(Duration.ofSeconds(60)).until(ExpectedConditions.presenceOfElementLocated(By.className("navbar-pf-vertical")));
}
}
代码示例来源:origin: EnMasseProject/enmasse
private void waitForRedirectToService() {
selenium.getDriverWait().withTimeout(Duration.ofSeconds(60)).until(ExpectedConditions.presenceOfElementLocated(By.tagName("service-instance-row")));
}
代码示例来源:origin: EnMasseProject/enmasse
@Override
public void checkReachableWebPage() {
selenium.getDriverWait().withTimeout(Duration.ofSeconds(30)).until(ExpectedConditions.presenceOfElementLocated(By.id("inputPassword")));
selenium.getAngularDriver().waitForAngularRequestsToFinish();
selenium.takeScreenShot();
}
}
代码示例来源:origin: EnMasseProject/enmasse
private WebElement getNavigateMenu() throws Exception {
selenium.getDriverWait().withTimeout(Duration.ofSeconds(30)).until(ExpectedConditions.presenceOfElementLocated(By.className("nav-pf-vertical")));
return selenium.getDriver().findElement(By.className("nav-pf-vertical"));
}
代码示例来源:origin: stackoverflow.com
@Test(enabled=true)
public void dependentDropdown(){
WebDriver driver = new FirefoxDriver();
driver.get("http://phppot.com/demo/jquery-dependent-dropdown-list-countries-and-states/");
driver.manage().timeouts().pageLoadTimeout(30, TimeUnit.SECONDS);
WebDriverWait wait = new WebDriverWait(driver, 30);
Select country = new Select(wait.until(ExpectedConditions.presenceOfElementLocated(By.id("country-list"))));
country.selectByVisibleText("India");
FluentWait<WebElement> waitFor_state_list_population = new FluentWait<WebElement>(driver.findElement(By.id("state-list")));
wait.withTimeout(60, TimeUnit.SECONDS).pollingEvery(1, TimeUnit.MILLISECONDS).ignoring(NoSuchElementException.class);
com.google.common.base.Function<WebElement, Boolean> elementLoaded = new com.google.common.base.Function<WebElement, Boolean>() {
@Override
public Boolean apply(WebElement ele) {
return ele.getTagName().equals("select")? new Select(ele).getOptions().size()>5? true: false: false;
}
};
if(waitFor_state_list_population.until(elementLoaded)){
Select state = new Select(driver.findElement(By.id("state-list")));
state.selectByVisibleText("Delhi");
}
driver.close();
driver.quit();
}
代码示例来源:origin: EnMasseProject/enmasse
private void waitUntilServiceIsReady() throws Exception {
getProvisionedServiceItem().expandServiceItem();
log.info("Waiting until provisioned service will be completed");
selenium.takeScreenShot();
selenium.getDriverWait().withTimeout(Duration.ofMinutes(5)).until(ExpectedConditions.numberOfElementsToBe(By.className("alert-info"), 0));
selenium.takeScreenShot();
}
内容来源于网络,如有侵权,请联系作者删除!