本文整理了Java中org.openqa.selenium.TimeoutException
类的一些代码示例,展示了TimeoutException
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TimeoutException
类的具体详情如下:
包路径:org.openqa.selenium.TimeoutException
类名称:TimeoutException
[英]Thrown when a command does not complete in enough time.
[中]当命令没有在足够的时间内完成时引发。
代码示例来源:origin: com.github.seykron/htmlunit-maven-plugin
/** {@inheritDoc}
*/
public void timeoutError(final HtmlPage htmlPage, final long allowedTime,
final long executionTime) {
exception = new TimeoutException("JavaScript timeout. Allowed time: "
+ allowedTime + ", Execution time: " + executionTime);
}
代码示例来源:origin: timurstrekalov/saga
@Override
public void until(final Predicate<JavascriptExecutor> isTrue) {
try {
super.until(isTrue);
} catch (final TimeoutException e) {
logger.debug(e.getMessage());
}
}
代码示例来源:origin: cz.etnetera/seb
@Override
protected RuntimeException timeoutException(String message, Throwable lastException) {
TimeoutException ex = new TimeoutException(message, lastException);
ex.addInfo(WebDriverException.DRIVER_INFO, context.getDriver().getClass().getName());
if (context.getDriver() instanceof RemoteWebDriver) {
RemoteWebDriver remote = (RemoteWebDriver) context.getDriver();
if (remote.getSessionId() != null) {
ex.addInfo(WebDriverException.SESSION_ID, remote.getSessionId().toString());
}
if (remote.getCapabilities() != null) {
ex.addInfo("Capabilities", remote.getCapabilities().toString());
}
}
throw ex;
}
代码示例来源:origin: com.wso2telco.test/uitest-framework
e.addSuppressed(e);
throw new NoSuchElementException("Timeout reached when searching for element!", e);
代码示例来源:origin: com.opera/operadriver
/**
* Throws a timeout exception. This method may be overridden to throw an exception that is
* idiomatic for a particular test infrastructure, such as an AssertionError in JUnit4.
*
* @param message the timeout message
* @param lastException the last exception to be thrown and subsequently suppressed while waiting
* on a function
* @return nothing will ever be returned; this return type is only specified as a convenience
*/
protected RuntimeException timeoutException(String message, Exception lastException) {
throw new TimeoutException(message, lastException);
}
代码示例来源:origin: com.github.arachnidium/arachnidium-core
private void postWindowUrl(IExtendedWindow window) {
try {
Log.message("URL is " + window.getCurrentUrl());
} catch (TimeoutException e) {
Log.debug("Couldn't get the current URL. " + e.getClass() + " :"
+ e.getMessage() + " was caught");
}
}
代码示例来源:origin: net.serenity-bdd/core
protected RuntimeException timeoutException(String message, RuntimeException lastException) {
throw new TimeoutException(message, lastException);
}
代码示例来源:origin: arachnidium/arachnidium-java
private void postWindowUrl(IExtendedWindow window) {
try {
Log.message("URL is " + window.getCurrentUrl());
} catch (TimeoutException e) {
Log.debug("Couldn't get the current URL. " + e.getClass() + " :"
+ e.getMessage() + " was caught");
}
}
}
代码示例来源:origin: net.thucydides/thucydides-core
protected RuntimeException timeoutException(String message, RuntimeException lastException) {
throw new TimeoutException(message, lastException);
}
代码示例来源:origin: qaprosoft/carina
/**
* wait Until Element Not Present
*
* @param locator By
* @param timeout long
* @param pollingTime long
*/
@Deprecated
public static void waitUntilElementNotPresent(final By locator, final long timeout, final long pollingTime) {
LOGGER.info(String.format("Wait until element %s disappear", locator.toString()));
WebDriver driver = getDriver();
try {
if (new WebDriverWait(driver, timeout, pollingTime).until(ExpectedConditions.invisibilityOfElementLocated(locator))) {
LOGGER.info(String.format("Element located by: %s not present.", locator.toString()));
} else {
LOGGER.info(String.format("Element located by: %s is still present.", locator.toString()));
}
} catch (TimeoutException e) {
LOGGER.debug(e.getMessage());
LOGGER.info(String.format("Element located by: %s is still present.", locator.toString()));
}
}
代码示例来源:origin: net.serenity-bdd/serenity-core
protected RuntimeException timeoutException(String message, RuntimeException lastException) {
throw new TimeoutException(message, lastException);
}
代码示例来源:origin: Cognifide/aet
@Override
public CollectorStepResult collect() {
CollectorStepResult result;
try {
result = WaitForHelper.waitForExpectedCondition(webDriver, getTimeoutInSeconds(),
ExpectedConditions.visibilityOfElementLocated(getLocator()),
this::waitForImageCompletion);
} catch (TimeoutException te) {
final String message =
String.format("Failed to wait for image to be loaded with provided locator. Error: %s",
te.getMessage());
result = CollectorStepResult.newProcessingErrorResult(message);
LOGGER.warn(message, te);
}
return result;
}
代码示例来源:origin: com.opera/operadriver
private Exception propagateIfNotIgnored(Exception e) {
for (Class<? extends RuntimeException> ignoredException : ignoredExceptions) {
if (ignoredException.isInstance(e)) {
return e;
}
}
throw new TimeoutException(e);
}
代码示例来源:origin: com.cognifide.aet/jobs
@Override
public CollectorStepResult collect() {
CollectorStepResult result;
try {
result = WaitForHelper.waitForExpectedCondition(webDriver, getTimeoutInSeconds(),
ExpectedConditions.visibilityOfElementLocated(getLocator()),
this::waitForImageCompletion);
} catch (TimeoutException te) {
final String message =
String.format("Failed to wait for image to be loaded with provided locator. Error: %s",
te.getMessage());
result = CollectorStepResult.newProcessingErrorResult(message);
LOGGER.warn(message, te);
}
return result;
}
代码示例来源:origin: com.pojosontheweb/selenium-utils-core
/**
* Evaluates this Findr, and blocks until all conditions are satisfied. Throws
* a TimeoutException otherwise.
* @param failureMessage A message to be included to the timeout exception
*/
public void eval(String failureMessage) throws TimeoutException {
try {
eval();
} catch(TimeoutException e) {
throw new TimeoutException(failureMessage, e);
}
}
代码示例来源:origin: WasiqB/coteafs-appium
/**
* @author wasiq.bhamla
* @return message
* @since 09-May-2017 8:46:51 PM
*/
public String handleAlert () {
log.trace ("Handling iOS Alert pop-up...");
try {
final Alert alert = this.wait.until (d -> d.switchTo ()
.alert ());
final String description = alert.getText ();
final String msg = "Alert Text: [%s]";
log.info (format (msg, description));
alert.accept ();
return description;
}
catch (final TimeoutException e) {
log.warn ("Expecting Alert not displayed...");
log.warn (e.getMessage ());
}
catch (final NoSuchSessionException e) {
fail (AppiumServerStoppedError.class, SERVER_STOPPED, e);
}
return null;
}
代码示例来源:origin: com.pojosontheweb/selenium-utils-core
/**
* Evaluates this ListFindr. Throws
* a TimeoutException if the condition chain didn't match.
* @param failureMessage A message to include in the timeout exception
* @throws TimeoutException if at least one condition in the chain failed
*/
public void eval(String failureMessage) throws TimeoutException {
try {
eval(IDENTITY_LIST);
} catch(TimeoutException e) {
throw new TimeoutException(failureMessage, e);
}
}
代码示例来源:origin: com.cognifide.aet/jobs
@Override
public CollectorStepResult collect() throws ProcessingException {
CollectorStepResult result;
try {
result = WaitForHelper.waitForExpectedCondition(webDriver, getTimeoutInSeconds(),
ExpectedConditions.visibilityOfElementLocated(getLocator()));
} catch (TimeoutException te) {
final String message =
String.format("Failed to wait for element to be visible with provided locator. "
+ "Page: %s. Error: %s", webDriver.getCurrentUrl(), te.getMessage());
result = CollectorStepResult.newProcessingErrorResult(message);
LOGGER.warn(message, te);
}
return result;
}
代码示例来源:origin: com.pojosontheweb/selenium-utils-core
/**
* Evaluates this ListFindr and invokes passed callback if the whole chain suceeded. Throws
* a TimeoutException with passed failure message if the condition chain didn't match.
* @param callback the callback to call if the chain succeeds
* @param <T> the rturn type of the callback
* @return the result of the callback
* @throws TimeoutException if at least one condition in the chain failed
*/
public <T> T eval(Function<List<WebElement>, T> callback, String failureMessage) throws TimeoutException {
try {
return eval(callback);
} catch(TimeoutException e) {
throw new TimeoutException(failureMessage, e);
}
}
代码示例来源:origin: org.kurento/kurento-room-test
public void verifyVideoInBrowser(Browser browser, String browserLabel, String chromeName,
String videoElementId, boolean isActive) {
if (isActive) {
log.debug("Verifing element {} exists in browser of {}", videoElementId, chromeName);
try {
WebElement video = findElement(browserLabel, browser, videoElementId);
if (video == null) {
fail("Video element " + videoElementId + " was not found in browser of " + chromeName);
}
} catch (NoSuchElementException e) {
fail(e.getMessage());
}
log.debug("OK - element {} found in browser of {}", videoElementId, chromeName);
} else {
log.debug("Verifing element {} is missing from browser of {}", videoElementId, chromeName);
try {
waitWhileElement(browserLabel, browser, videoElementId);
} catch (TimeoutException e) {
fail(e.getMessage());
}
log.debug("OK - element {} is missing from browser of {}", videoElementId, chromeName);
}
}
内容来源于网络,如有侵权,请联系作者删除!