@Override public void waitUntilCompleted() { try { long end = MILLISECONDS.convert(duration.getTime(), duration.getUnit()); long time = (start + end) - System.currentTimeMillis(); if (time > 0) { Sleeper.SYSTEM_SLEEPER.sleep(new org.openqa.selenium.support.ui.Duration(time, MILLISECONDS)); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new RuntimeException(e); } finally { start = -1; } }
private void sleepSeconds(long seconds) { try { Sleeper.SYSTEM_SLEEPER.sleep(new Duration(seconds, java.util.concurrent.TimeUnit.SECONDS)); } catch (InterruptedException e) { e.printStackTrace(); } }
private void sleep(long ms) { try { Sleeper.SYSTEM_SLEEPER.sleep(new Duration(ms, java.util.concurrent.TimeUnit.MILLISECONDS)); } catch (InterruptedException e) { e.printStackTrace(); } }
public void sleep(Duration duration) { try { Sleeper.SYSTEM_SLEEPER.sleep(duration); } catch (InterruptedException e) { throw new RuntimeException(e); } }
protected SearchContextWait(final SearchContext input, final Clock clock, final Sleeper sleeper, final long timeout, final TimeUnit timeoutTimeUnit, final long sleep, final TimeUnit sleepTimeUnit) { super(input, clock, sleeper); withTimeout(timeout, timeoutTimeUnit); pollingEvery(sleep, sleepTimeUnit); ignoring(NotFoundException.class); }
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); }
private DemoApplication(final WebDriver driver) { super(driver); try { Sleeper.SYSTEM_SLEEPER.sleep(new Duration(5, TimeUnit.SECONDS)); } catch (InterruptedException e) { throw new RuntimeException("cannot wait", e); } }
public DemoDragMultiple revealDemoDragMultiple() { try { Sleeper.SYSTEM_SLEEPER.sleep(new Duration(5, TimeUnit.SECONDS)); return new DemoDragMultiple(driver, this).reveal(); } catch (InterruptedException e) { throw new RuntimeException("do the thing "); } }
protected void waitMillis(long timeout) throws InterruptedException { Sleeper.SYSTEM_SLEEPER.sleep(new Duration(timeout, TimeUnit.MILLISECONDS)); }
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 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 clock * The clock to use when measuring the timeout * @param sleeper * Object used to make the current thread go to sleep. * @param timeOutInSeconds * The timeout in seconds when an expectation is * @param sleepTimeOut * The timeout used whilst sleeping. Defaults to 500ms called. */ public SearchContextWait(SearchContext context, Clock clock, Sleeper sleeper, long timeOutInSeconds, long sleepTimeOut) { super(context, clock, sleeper); withTimeout(timeOutInSeconds, TimeUnit.SECONDS); pollingEvery(sleepTimeOut, TimeUnit.MILLISECONDS); ignoring(NotFoundException.class); this.context = context; }
/** * @param driver * The WebDriver instance to pass to the expected conditions * @param clock * The clock to use when measuring the timeout * @param sleeper * Object used to make the current thread go to sleep. * @param timeOutInSeconds * The timeout in seconds when an expectation is * @param sleepTimeOut * The timeout used whilst sleeping. Defaults to 500ms called. */ protected QAFWebDriverWait(QAFExtendedWebDriver driver, Clock clock, Sleeper sleeper, long timeOutInMiliSeconds, long sleepTimeOut) { super(driver, clock, sleeper); withTimeout(timeOutInMiliSeconds, TimeUnit.MILLISECONDS); pollingEvery(sleepTimeOut, TimeUnit.MILLISECONDS); ignoring(StaleElementReferenceException.class); }
/** * @param element * The WebElement instance to pass to the expected conditions * @param clock * The clock to use when measuring the timeout * @param sleeper * Object used to make the current thread go to sleep. * @param timeOutInSeconds * The timeout in seconds when an expectation is * @param sleepTimeOut * The timeout used whilst sleeping. Defaults to 500ms called. */ @SuppressWarnings("unchecked") protected QAFWebElementWait(QAFExtendedWebElement element, Clock clock, Sleeper sleeper, long timeOutInMiliSeconds, long sleepTimeOut) { super(element, clock, sleeper); withTimeout(timeOutInMiliSeconds, TimeUnit.MILLISECONDS); pollingEvery(sleepTimeOut, TimeUnit.MILLISECONDS); ignore(NoSuchElementException.class, StaleElementReferenceException.class); }
/** * 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); }