use of com.paulhammant.ngwebdriver.NgWebDriver in project ORCID-Source by ORCID.
the class BBBUtil method angularHasFinishedProcessing.
public static ExpectedCondition<Boolean> angularHasFinishedProcessing() {
/*
* Getting complex. 1. We want to make sure Angular is done. So you call
* the rootScope apply 2. We want to make sure the browser is done
* rendering the DOM so we call $timeout
* http://blog.brunoscopelliti.com/run-a-directive-after-the-dom-has-
* finished-rendering/ 3. make sure there are no pending AJAX request,
* if so start over
*/
return new ExpectedCondition<Boolean>() {
@Override
public Boolean apply(WebDriver driver) {
JavascriptExecutor javascriptExecutor = (JavascriptExecutor) driver;
javascriptExecutor.executeScript(jQueryWaitScript);
Object obj = javascriptExecutor.executeScript("" + "return window._selenium_jquery_done;");
Boolean jqueryDone = (obj == null ? false : Boolean.valueOf(obj.toString()));
if (jqueryDone) {
NgWebDriver ngWebDriver = new NgWebDriver(javascriptExecutor);
ngWebDriver.waitForAngularRequestsToFinish();
}
return jqueryDone;
}
};
}
use of com.paulhammant.ngwebdriver.NgWebDriver in project opentest by mcdcorp.
the class SeleniumTestAction method waitForAsyncCallsToFinish.
/**
* Waits for JavaScript asynchronous logic in the web page to finish
* (Angular, React, etc).
*/
protected void waitForAsyncCallsToFinish() {
try {
JavascriptExecutor jsExecutor = (JavascriptExecutor) this.driver;
NgWebDriver ngDriver = new NgWebDriver(jsExecutor);
ngDriver.waitForAngularRequestsToFinish();
} catch (Exception ex) {
log.warning("The waitForAsyncCallsToFinish method failed.", ex);
}
}
Aggregations