@Override public Statement apply(Statement statement) throws Throwable { return () -> { Clock clock = new SystemClock(); long end = clock.laterBy(timeout.in(TimeUnit.MILLISECONDS)); Throwable lastException; do { try { return statement.evaluate(); } catch (Throwable e) { lastException = e; if (ignoring.stream().anyMatch(clazz -> clazz.isInstance(e))) { try { Thread.sleep(polling.in(TimeUnit.MILLISECONDS)); } catch (InterruptedException i) { break; } } else { Throwables.propagate(e); } } } while ((clock.isNowBefore(end))); throw lastException; }; }
public CompletedToDosPage(WebDriver driver, TodoMVCSite site){ super(new SystemClock(), 10); this.driver = driver; this.site = site; // delegate to the main page // normally we would do this for components, but since this is a // single page app, the 'pages' are somewhat artificial and this // avoids duplicated code page = new ApplicationPageStructuralSlowLoadable(driver, site); }
public AllToDosPage(WebDriver driver, TodoMVCSite site){ super(new SystemClock(), 10); this.driver = driver; this.site = site; // delegate to the main page // normally we would do this for components, but since this is a // single page app, the 'pages' are somewhat artificial and this // avoids duplicated code page = new ApplicationPageStructuralSlowLoadable(driver, site); }
public ActiveToDosPage(WebDriver driver, TodoMVCSite site){ super(new SystemClock(), 10); this.driver = driver; this.site = site; // delegate to the main page // normally we would do this for components, but since this is a // single page app, the 'pages' are somewhat artificial and this // avoids duplicated code page = new ApplicationPageStructuralSlowLoadable(driver, site); }
public CompletedToDosPageNoLoad(WebDriver driver, TodoMVCSite site){ super(new SystemClock(), 10); this.driver = driver; this.site = site; // delegate to the main page // normally we would do this for components, but since this is a // single page app, the 'pages' are somewhat artificial and this // avoids duplicated code page = new ApplicationPageStructuralSlowLoadable(driver, site); }
public ActiveToDosPageNoLoad(WebDriver driver, TodoMVCSite site){ super(new SystemClock(), 10); this.driver = driver; this.site = site; // delegate to the main page // normally we would do this for components, but since this is a // single page app, the 'pages' are somewhat artificial and this // avoids duplicated code page = new ApplicationPageStructuralSlowLoadable(driver, site); }
public AllToDosPageNoLoad(WebDriver driver, TodoMVCSite site){ super(new SystemClock(), 10); this.driver = driver; this.site = site; // delegate to the main page // normally we would do this for components, but since this is a // single page app, the 'pages' are somewhat artificial and this // avoids duplicated code page = new ApplicationPageStructuralSlowLoadable(driver, site); }
public ApplicationPageStructuralSlowLoadable(WebDriver driver, TodoMVCSite todoMVCSite) { super(new SystemClock(), 10); this.driver = driver; this.todoMVCSite = todoMVCSite; wait = new WebDriverWait(driver,10); // move the mouse out of the way so it // doesn't interfere with the test try { new Robot().mouseMove(0,0); } catch (AWTException e) { e.printStackTrace(); } }
/** * Constructs an {@code AbstractLoadable} with the state specified by the {@code LoadableBean}. * * @param bean the data transfer object for constructing this {@code AbstractLoadable} */ public AbstractLoadable(final LoadableBean bean) { super(new SystemClock(), bean.getLoadTimeout()); this.driver = bean.getDriver(); this.loadTimeout = bean.getLoadTimeout(); }
public SeleniumWait(WebDriver input) { super(input, new SystemClock(), new Sleeper() { @Override public void sleep(Duration duration) { } }); ignoring(NoSuchElementException.class, StaleElementReferenceException.class); pollingEvery(100, TimeUnit.MILLISECONDS); }
public PublicLoadableComponentWaiter(LoadableComponent aComponent) { clock = new SystemClock(); this.componentName = aComponent.getClass().getCanonicalName(); this.isLoadedPage = new PublicIsLoadableComponent(aComponent); }
public WebDriverWait2(final WebDriver driver, final long timeOutInSeconds, final long sleepInMillis) { super(driver, new SystemClock(), Sleeper.SYSTEM_SLEEPER, timeOutInSeconds, sleepInMillis); }
public WebElementWait(SearchContext element, long timeoutInSeconds) { super(element, new SystemClock(), Sleeper.SYSTEM_SLEEPER); withTimeout(timeoutInSeconds, TimeUnit.SECONDS); pollingEvery(500, TimeUnit.MILLISECONDS); ignoring(WebDriverException.class); }
public QueNessSlowLoadingExamplePage(WebDriver driver) { super(new SystemClock(), 10); this.driver = driver; }
public SearchContextWait(final SearchContext input, final long timeoutMillis) { this(input, new SystemClock(), Sleeper.SYSTEM_SLEEPER, timeoutMillis, TimeUnit.MILLISECONDS, DEFAULT_SLEEP_TIMEOUT, TimeUnit.MILLISECONDS); }
public SearchContextWait(final SearchContext input, final long timeoutMillis, final long sleepMillis) { this(input, new SystemClock(), Sleeper.SYSTEM_SLEEPER, timeoutMillis, TimeUnit.MILLISECONDS, sleepMillis, TimeUnit.MILLISECONDS); }
/** * Wait will ignore instances of NotFoundException that are encountered * (thrown) by default in the 'until' condition, and immediately propagate * all others. You can add more to the ignore list by calling * ignoring(exceptions to add). * * @param context * The SearchContext instance to pass to the expected conditions * @param timeOutInSeconds * The timeout in seconds when an expectation is called * @see SearchContextWait#ignoring(java.lang.Class) */ public SearchContextWait(SearchContext context, long timeOutInSeconds) { this(context, new SystemClock(), Sleeper.SYSTEM_SLEEPER, timeOutInSeconds, DEFAULT_SLEEP_TIMEOUT); }
/** * Wait will ignore instances of NotFoundException that are encountered * (thrown) by default in the 'until' condition, and immediately propagate * all others. You can add more to the ignore list by calling * ignoring(exceptions to add). * * @param context * The SearchContext instance to pass to the expected conditions * @param timeOutInSeconds * The timeout in seconds when an expectation is called * @param sleepInMillis * The duration in milliseconds to sleep between polls. * @see SearchContextWait#ignoring(java.lang.Class) */ public SearchContextWait(SearchContext context, long timeOutInSeconds, long sleepInMillis) { this(context, new SystemClock(), Sleeper.SYSTEM_SLEEPER, timeOutInSeconds, sleepInMillis); }
/** * Wait will ignore instances of NotFoundException that are encountered * (thrown) by default in the 'until' condition, and immediately propagate * all others. You can add more to the ignore list by calling * ignoring(exceptions to add). * * @param driver * The WebDriver instance to pass to the expected conditions * @param timeOutInMiliSeconds * The timeout in seconds when an expectation is called * @see QAFWebDriverWait#ignoring(Class[]) equals */ public QAFWebDriverWait(QAFExtendedWebDriver driver, long timeOutInMiliSeconds) { this(driver, new SystemClock(), Sleeper.SYSTEM_SLEEPER, timeOutInMiliSeconds, getDefaultInterval()); }
/** * Wait will ignore instances of NotFoundException that are encountered * (thrown) by default in the 'until' condition, and immediately propagate * all others. You can add more to the ignore list by calling * ignoring(exceptions to add). * * @param driver * The WebDriver instance to pass to the expected conditions * @param timeOutInMiliSeconds * The timeout in seconds when an expectation is called * @param sleepInMillis * The duration in milliseconds to sleep between polls. * @see QAFWebDriverWait#ignoring(Class[]) equals */ public QAFWebDriverWait(QAFExtendedWebDriver driver, long timeOutInMiliSeconds, long sleepInMillis) { this(driver, new SystemClock(), Sleeper.SYSTEM_SLEEPER, timeOutInMiliSeconds, sleepInMillis); }
/** * Wait will ignore instances of NotFoundException that are encountered * (thrown) by default in the 'until' condition, and immediately propagate * all others. You can add more to the ignore list by calling * ignoring(exceptions to add). * * @param element * The WebElement instance to pass to the expected conditions * @param timeOutInMiliSeconds * The timeout in seconds when an expectation is called * @see QAFWebElementWait#ignoring(Class[]) equals */ public QAFWebElementWait(QAFExtendedWebElement element, long timeOutInMiliSeconds) { this(element, new SystemClock(), Sleeper.SYSTEM_SLEEPER, timeOutInMiliSeconds, getDefaultInterval()); }
/** * Wait will ignore instances of NotFoundException that are encountered * (thrown) by default in the 'until' condition, and immediately propagate * all others. You can add more to the ignore list by calling * ignoring(exceptions to add). * * @param element * The WebElement instance to pass to the expected conditions * @param timeOutInMiliSeconds * The timeout in seconds when an expectation is called * @param sleepInMillis * The duration in milliseconds to sleep between polls. * @see QAFWebElementWait#ignoring(Class[]) equals */ public QAFWebElementWait(QAFExtendedWebElement element, long timeOutInMiliSeconds, long sleepInMillis) { this(element, new SystemClock(), Sleeper.SYSTEM_SLEEPER, timeOutInMiliSeconds, sleepInMillis); }