use of org.openqa.selenium.TimeoutException in project flow by vaadin.
the class ComponentThemeLiveReloadIT method checkNoWebpackErrors.
private void checkNoWebpackErrors(String theme) {
getLogEntries(java.util.logging.Level.ALL).forEach(logEntry -> {
if (logEntry.getMessage().contains("Module build failed")) {
Assert.fail(String.format("Webpack error detected in the browser console after " + "deleting '%s' component style sheet: %s\n\n", theme, logEntry.getMessage()));
}
});
final By byErrorOverlayClass = By.className("v-system-error");
try {
waitForElementNotPresent(byErrorOverlayClass);
} catch (TimeoutException e) {
WebElement error = findElement(byErrorOverlayClass);
Assert.fail(String.format("Webpack error overlay detected after deleting '%s' " + "component style sheet: %s\n\n", theme, error.getText()));
}
}
use of org.openqa.selenium.TimeoutException in project carina by qaprosoft.
the class DriverHelper method refresh.
/**
* Refresh browser.
*
* @param timeout long
*/
public void refresh(long timeout) {
WebDriver drv = getDriver();
Wait<WebDriver> wait = new FluentWait<WebDriver>(drv).pollingEvery(// there is no sense to refresh url address too often
Duration.ofMillis(5000)).withTimeout(Duration.ofSeconds(timeout)).ignoring(WebDriverException.class).ignoring(// org.openqa.selenium.json.JsonException: Expected to read a START_MAP but instead have: END. Last 0 characters read
JsonException.class);
try {
wait.until(new Function<WebDriver, Void>() {
public Void apply(WebDriver driver) {
drv.navigate().refresh();
return null;
}
});
} catch (ScriptTimeoutException | TimeoutException e) {
Messager.FAIL_REFRESH.error();
}
Messager.REFRESH.info();
}
use of org.openqa.selenium.TimeoutException in project carina by qaprosoft.
the class DriverHelper method waitUntil.
/**
* Wait until any condition happens.
*
* @param condition - ExpectedCondition.
* @param timeout - timeout.
* @return true if condition happen.
*/
public boolean waitUntil(ExpectedCondition<?> condition, long timeout) {
boolean result;
long startMillis = 0;
final WebDriver drv = getDriver();
Wait<WebDriver> wait = new WebDriverWait(drv, timeout, RETRY_TIME).ignoring(WebDriverException.class).ignoring(NoSuchSessionException.class);
try {
startMillis = System.currentTimeMillis();
wait.until(condition);
result = true;
LOGGER.debug("waitUntil: finished true...");
} catch (NoSuchElementException | TimeoutException e) {
// don't write exception even in debug mode
LOGGER.debug("waitUntil: NoSuchElementException | TimeoutException e..." + condition.toString());
result = false;
} catch (Exception e) {
LOGGER.error("waitUntil: " + condition.toString(), e);
result = false;
} finally {
long timePassed = System.currentTimeMillis() - startMillis;
// timePassed is time in ms timeout in sec so we have to adjust
if (timePassed > 2 * timeout * 1000) {
LOGGER.error("Your retry_interval is too low: " + RETRY_TIME + " ms! Increase it or upgrade your hardware");
}
}
return result;
}
use of org.openqa.selenium.TimeoutException in project carina by qaprosoft.
the class AbstractUIObjectListHandler method waitUntil.
/**
* Wait until any condition happens.
*
* @param condition - ExpectedCondition.
* @return true if condition happen.
*/
@SuppressWarnings("unchecked")
private boolean waitUntil(ExpectedCondition<?> condition) {
boolean result;
long timeout = Configuration.getLong(Parameter.EXPLICIT_TIMEOUT);
long RETRY_TIME = Configuration.getLong(Parameter.RETRY_INTERVAL);
@SuppressWarnings("rawtypes") Wait wait = new WebDriverWait(webDriver, timeout, RETRY_TIME).ignoring(WebDriverException.class).ignoring(NoSuchSessionException.class);
try {
wait.until(condition);
result = true;
LOGGER.debug("waitUntil: finished true...");
} catch (NoSuchElementException | TimeoutException e) {
// don't write exception even in debug mode
LOGGER.debug("waitUntil: NoSuchElementException | TimeoutException e..." + condition.toString());
result = false;
} catch (Exception e) {
LOGGER.error("waitUntil: " + condition.toString(), e);
result = false;
}
return result;
}
use of org.openqa.selenium.TimeoutException in project devonfw-testing by devonfw.
the class DriverExtention method waitUntilElementIsClickable.
public WebElement waitUntilElementIsClickable(final By by) {
BasePage.getAnalytics().sendMethodEvent(BasePage.analitycsCategoryName);
long startTime = System.currentTimeMillis();
WebElement element = null;
try {
element = webDriverWait().until(ExpectedConditions.elementToBeClickable(by));
} catch (TimeoutException | NoSuchElementException e) {
boolean isTimeout = true;
throw new BFElementNotFoundException(by, isTimeout, BasePage.EXPLICITYWAITTIMER);
}
BFLogger.logTime(startTime, "waitUntilElementIsClickable()", by.toString());
return element;
}
Aggregations