Search in sources :

Example 1 with SafeJavascriptWait

use of com.github.timurstrekalov.saga.core.webdriver.SafeJavascriptWait in project saga by timurstrekalov.

the class GenericInstrumentingBrowser method get.

@Override
public void get(final String url) {
    driver.get(url);
    final JavascriptExecutor js = (JavascriptExecutor) driver;
    WebDriverUtils.waitForWindowJavaScriptVariableToBePresent(js, SAGA_NAMESPACE);
    new SafeJavascriptWait(js).withTimeout(config.getBackgroundJavaScriptTimeout(), TimeUnit.MILLISECONDS).until(new Predicate<JavascriptExecutor>() {

        @Override
        public boolean apply(final JavascriptExecutor input) {
            logger.debug("Waiting for test runner to finish");
            return Boolean.TRUE.equals(input.executeScript("return " + SAGA_NAMESPACE + ".completed()"));
        }
    });
}
Also used : JavascriptExecutor(org.openqa.selenium.JavascriptExecutor) SafeJavascriptWait(com.github.timurstrekalov.saga.core.webdriver.SafeJavascriptWait)

Aggregations

SafeJavascriptWait (com.github.timurstrekalov.saga.core.webdriver.SafeJavascriptWait)1 JavascriptExecutor (org.openqa.selenium.JavascriptExecutor)1