本文整理了Java中org.jboss.arquillian.graphene.wait.WebDriverWait.withTimeout()
方法的一些代码示例,展示了WebDriverWait.withTimeout()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebDriverWait.withTimeout()
方法的具体详情如下:
包路径:org.jboss.arquillian.graphene.wait.WebDriverWait
类名称:WebDriverWait
方法名:withTimeout
暂无
代码示例来源:origin: org.jboss.arquillian.graphene/graphene-webdriver-impl
public RequestGuardFactory(RequestGuard guard, Document document, GrapheneContext context) {
this.guard = guard;
this.document = document;
this.context = context;
this.waitGuard = waitAjax()
.withTimeout(context.getConfiguration().getWaitGuardInterval(), TimeUnit.SECONDS)
.pollingEvery(Math.min(context.getConfiguration().getWaitGuardInterval() * 100, 200), TimeUnit.MILLISECONDS);
}
代码示例来源:origin: arquillian/arquillian-graphene
public RequestGuardFactory(RequestGuard guard, Document document, GrapheneContext context) {
this.guard = guard;
this.document = document;
this.context = context;
this.waitGuard = waitAjax()
.withTimeout(context.getConfiguration().getWaitGuardInterval(), TimeUnit.SECONDS)
.pollingEvery(Math.min(context.getConfiguration().getWaitGuardInterval() * 100, 200), TimeUnit.MILLISECONDS);
}
代码示例来源:origin: arquillian/arquillian-graphene
@Test
public void testWithTimeout() {
TimeUnit unit = TimeUnit.MILLISECONDS;
long duration = 2000;
long started = System.currentTimeMillis();
try {
Graphene.waitModel()
.withTimeout(duration, unit)
.until()
.element(BY_HEADER)
.text()
.equalTo("sjkldhkdjfgjlkfg");
Assert.fail(TimeoutException.class.getName() + " should be thrown.");
} catch(TimeoutException e) {
long was = System.currentTimeMillis() - started;
Assert.assertTrue("The waiting time shouldn't be much bigger than " + duration + " " + unit + ", but was " + was + " ms.",
was < unit.toMillis(duration + duration / 2));
Assert.assertTrue("The waiting time shouldn't lower than " + duration + " " + unit + ", but was " + was + " ms.",
was >= unit.toMillis(duration));
}
}
代码示例来源:origin: org.richfaces/richfaces-page-fragments
@Override
public boolean addFile(File file) {
final int expectedSize = advanced().getFileInputElements().size() + 1;
String containerStyleClassBefore = advanced().getInputContainer().getAttribute("class");
Utils.jQ("attr('class', '')", advanced().getInputContainer());
if (browser instanceof PhantomJSDriver) {
// workaround for PhantomJS where usual upload does not work
((PhantomJSDriver) browser).executePhantomJS("var page = this; page.uploadFile('input[type=file]', '"
+ file.getAbsolutePath() + "');");
} else {
// for all other browsers
advanced().getFileInputElement().sendKeys(file.getAbsolutePath());
}
Utils.jQ("attr('class', '" + containerStyleClassBefore + "')", advanced().getInputContainer());
try {
Graphene.waitGui().withTimeout(1, TimeUnit.SECONDS).until(new Predicate<WebDriver>() {
@Override
public boolean apply(WebDriver input) {
return advanced().getFileInputElements().size() == expectedSize;
}
});
} catch (TimeoutException ignored) {
return FALSE;
}
return TRUE;
}
代码示例来源:origin: GoogleCloudPlatform/appengine-tck
@Test
@RunAsClient
@InSequence(20)
public void testTimeout(@ArquillianResource URL url) throws Exception {
// 1. Create our test with a unique channel id.
final String channelId = "" + System.currentTimeMillis();
// Set timeout for 1 minute.
String params = String.format("/channelPage.jsp?test-channel-id=%s&timeout-minutes=%d", channelId, 1);
driver.get(url + params);
// 2. Verify that the server received our channel id and is using it for this tests.
WebElement channel = driver.findElement(By.id("channel-id"));
assertEquals(channelId, channel.getText());
// 3. Verify that the channel gets closed after the 1 minute timeout.
Graphene.waitModel(driver).until().element(By.id("status")).text().equalTo("opened");
// This should put us over the 1 minute timeout.
Graphene.waitModel(driver).withTimeout(90, TimeUnit.SECONDS).until().element(By.id("status")).text().equalTo("closed");
}
}
代码示例来源:origin: GoogleCloudPlatform/appengine-tck
Graphene.waitModel(driver).withTimeout(5, TimeUnit.SECONDS).until().element(button).is().enabled();
button.click();
} catch (NoSuchElementException e) {
内容来源于网络,如有侵权,请联系作者删除!