public boolean wait(BooleanSupplier waitCase) { Throwable exception = null; while (!timeoutPassed()) try { if (waitCase.getAsBoolean()) return true; sleep(retryTimeoutInMSec); } catch (Exception | Error ex) { exception = ex; } if (exception != null) throw new RuntimeException(exception); return false; }
public boolean wait(BooleanSupplier waitCase) { Throwable exception = null; while (!timeoutPassed()) try { if (waitCase.getAsBoolean()) return true; sleep(retryTimeoutInMSec); } catch (Exception | Error ex) { exception = ex; } if (exception != null) throw new RuntimeException(exception); return false; }
public <T> T getResultByCondition(Supplier<T> getFunc, Function<T, Boolean> conditionFunc) { Throwable exception = null; do { try { T result = getFunc.get(); if (result != null && conditionFunc.apply(result)) return result; } catch (Exception | Error ex) { exception = ex; } sleep(retryTimeoutInMSec); } while (!timeoutPassed()); if (exception != null) throw new RuntimeException(exception); return null; }
public <T> T getResultByCondition(Supplier<T> getFunc, Function<T, Boolean> conditionFunc) { Throwable exception = null; do { try { T result = getFunc.get(); if (result != null && conditionFunc.apply(result)) return result; } catch (Exception | Error ex) { exception = ex; } sleep(retryTimeoutInMSec); } while (!timeoutPassed()); if (exception != null) throw new RuntimeException(exception); return null; }
/** * Click on root element, send keys to the input and select a value from the list with some delay if it needed */ public void select(String query, String option) { Timer.sleep(actionTimeout); click(); Timer.sleep(actionTimeout); input().setValue(query); Timer.sleep(actionTimeout); list().select(option); }
/** * Click on root element, send keys to the input and select a value from the list with some delay if it needed */ public void select(String query, String option) { Timer.sleep(actionTimeout); click(); Timer.sleep(actionTimeout); input().setValue(query); Timer.sleep(actionTimeout); list().select(option); }
public void highlight(IElement element, HighlightSettings settings) { HighlightSettings highlightSettings = settings; if (highlightSettings == null) highlightSettings = new HighlightSettings(); WebElement webElement = ((Element) element).getHighLightElement(); String orig = webElement.getAttribute("style"); getJSExecutor().executeScript(format("arguments[0].setAttribute('%s',arguments[1]);", "style"), webElement, format("border: 3px solid %s; background-color: %s;", highlightSettings.getFrameColor(), highlightSettings.getBgColor())); sleep(highlightSettings.getTimeoutInSec() * 1000); getJSExecutor().executeScript(format("arguments[0].setAttribute('%s',arguments[1]);", "style"), webElement, orig); }
public void highlight(IElement element, HighlightSettings settings) { HighlightSettings highlightSettings = settings; if (highlightSettings == null) highlightSettings = new HighlightSettings(); WebElement webElement = ((Element) element).getHighLightElement(); String orig = webElement.getAttribute("style"); getJSExecutor().executeScript(format("arguments[0].setAttribute('%s',arguments[1]);", "style"), webElement, format("border: 3px solid %s; background-color: %s;", highlightSettings.getFrameColor(), highlightSettings.getBgColor())); sleep(highlightSettings.getTimeoutInSec() * 1000); getJSExecutor().executeScript(format("arguments[0].setAttribute('%s',arguments[1]);", "style"), webElement, orig); }
public void highlight(IElement element, HighlightSettings highlightSettings) { HighlightSettings settings = highlightSettings != null ? highlightSettings : new HighlightSettings(); String orig = ((Element) element).getWebElement().getAttribute("style"); element.setAttribute("style", format("border: 3px solid %s; background-color: %s;", highlightSettings.getFrameColor(), highlightSettings.getBgColor())); sleep(highlightSettings.getTimeoutInSec() * 1000); element.setAttribute("style", orig); }
sleep(1000);