public void waitForTextToAppear(final String expectedText, final long timeout) { waitForCondition() .withTimeout(timeout, TimeUnit.MILLISECONDS) .until(textPresent(expectedText)); }
public ThucydidesFluentWait<WebDriver> waitForCondition() { return new NormalFluentWait<WebDriver>(driver, webdriverClock, sleeper) .withTimeout(waitForTimeoutInMilliseconds, TimeUnit.MILLISECONDS) .pollingEvery(WAIT_FOR_ELEMENT_PAUSE_LENGTH, TimeUnit.MILLISECONDS) .ignoring(NoSuchElementException.class, NoSuchFrameException.class); }
@Override public <V> V until(Function<? super T, V> isTrue) { long end = getClock().millis() + timeout.toMillis(); RuntimeException lastException = null; String waitForConditionMessage = isTrue.toString(); while (true) { if (aPreviousStepHasFailed()) { return (V) Boolean.TRUE; lastException = propagateIfNotIngored(e); if (!(getClock().millis() < end)){ String message = String.format("Timed out after %d milliseconds: ",timeout.toMillis()) + waitForConditionMessage; throw timeoutException(message, lastException); doWait(); } catch (InterruptedException e) { Thread.currentThread().interrupt();
/** * This method will wait until an element is present and visible on the screen. */ public void waitFor(final By byElementCriteria) { waitForCondition().until(elementDisplayed(byElementCriteria)); }
private void waitForKeywordToBeUpdatedTo(String keyword) { waitForCondition() .withTimeout(5, TimeUnit.SECONDS) .pollingEvery(250,TimeUnit.MILLISECONDS) .until(keywordFieldIsUpdatedTo(keyword)); }
@Override protected ThucydidesFluentWait<T> updateWaitBy(int amount, TimeUnit unit) { return fluentWait.withTimeout(amount, unit); } }
@Override protected ThucydidesFluentWait<T> updateWaitBy(int amount, TimeUnit unit) { return fluentWait.pollingEvery(amount, unit); }
/** * Waits for a given text to disappear from the element. */ public PageObject waitForTextToDisappear(final WebElement element, final String expectedText) { waitForCondition().until(elementDoesNotContain(element, expectedText)); return this; }
@Override protected ThucydidesFluentWait<T> updateWaitBy(int amount, TimeUnit unit) { return fluentWait.withTimeout(amount, unit); } }
@Override protected ThucydidesFluentWait<T> updateWaitBy(int amount, TimeUnit unit) { return fluentWait.pollingEvery(amount, unit); }
/** * This method will wait until an element is present and visible on the screen. */ public void waitFor(final By byElementCriteria) { waitForCondition().until(elementDisplayed(byElementCriteria)); }
public <V> V until(Function<? super T, V> isTrue) { long end = getClock().laterBy(timeout.in(MILLISECONDS)); RuntimeException lastException = null; while (true) { if (aPreviousStepHasFailed()) { return (V) Boolean.TRUE; lastException = propagateIfNotIngored(e); if (!getClock().isNowBefore(end)) { throw timeoutException(String.format("Timed out after %d seconds", timeout.in(SECONDS)), lastException); doWait(); } catch (InterruptedException e) { Thread.currentThread().interrupt();
public void waitForTextToDisappear(final String expectedText, final long timeout) { waitForCondition() .withTimeout(timeout, TimeUnit.MILLISECONDS) .until(textNotPresent(expectedText)); }
public ThucydidesFluentWait<WebDriver> waitForCondition() { return new NormalFluentWait<WebDriver>(driver, webdriverClock, sleeper) .withTimeout(waitForTimeoutInMilliseconds, TimeUnit.MILLISECONDS) .pollingEvery(WAIT_FOR_ELEMENT_PAUSE_LENGTH, TimeUnit.MILLISECONDS) .ignoring(NoSuchElementException.class, NoSuchFrameException.class); }
@Override protected ThucydidesFluentWait<T> updateWaitBy(int amount, TimeUnit unit) { return fluentWait.withTimeout(amount, unit); } }
@Override protected ThucydidesFluentWait<T> updateWaitBy(int amount, TimeUnit unit) { return fluentWait.pollingEvery(amount, unit); }
private List<WebElementFacade> waitForElements(final List<WebElementFacade> elements) { waitForCondition().until(elementsAreDisplayed(elements)); return elements; }
public <V> V until(Function<? super T, V> isTrue) { long end = getClock().laterBy(timeout.in(MILLISECONDS)); RuntimeException lastException = null; String waitForConditionMessage = isTrue.toString(); while (true) { if (aPreviousStepHasFailed()) { return (V) Boolean.TRUE; lastException = propagateIfNotIngored(e); if (!getClock().isNowBefore(end)) { String message = String.format("Timed out after %d milliseconds: ",timeout.in(MILLISECONDS)) + waitForConditionMessage; throw timeoutException(message, lastException); doWait(); } catch (InterruptedException e) { Thread.currentThread().interrupt();
public void waitForTextToDisappear(final String expectedText, final long timeout) { waitForCondition() .withTimeout(timeout, TimeUnit.MILLISECONDS) .until(textNotPresent(expectedText)); }
public ThucydidesFluentWait<WebDriver> waitForWithRefresh() { return new FluentWaitWithRefresh<WebDriver>(driver, webdriverClock, sleeper) .withTimeout(waitForTimeoutInMilliseconds, TimeUnit.MILLISECONDS) .pollingEvery(WAIT_FOR_ELEMENT_PAUSE_LENGTH, TimeUnit.MILLISECONDS) .ignoring(NoSuchElementException.class, NoSuchFrameException.class); }