Reputation: 95
I am using a similar implementation to what Salim posted here Testing AngularJS with Selenium
However, when ran, the check will systematically wait the "webdriver wait" period.
From what I see, the boolean check will always return false, no matter what.
Anyone has any ideas?
I've tried to shorten the timeout value of the wait as well as changing the pooling rate, but all that did is use those new values, not really "returning true" to the check.
// Will check if Angular still has pending http_requests ongoing and wait if required
public boolean untilAngularHasFinishedProcessing()
{
until(() ->
{
final boolean hasFinishedLoading = Boolean.valueOf(((JavascriptExecutor) driver)
.executeScript("return (window.angular !== undefined) "
+ "&& (angular.element(document).injector()!==undefined) "
+ "&&(angular.element(document).injector().get('$http')"
+ ".pendingRequests.length===0)").toString());
log.info("Waiting on angular to finish processing => " + hasFinishedLoading);
return hasFinishedLoading;
}
);
return true;
}
Expected: the wait should end as soon as Angular doesn't have any pending http_requests
Result: Always reach the "timeout" no matter what
Upvotes: 1
Views: 356
Reputation: 95
Think I've found the problem: our application uses Angular 6.x while this check is for Angular 1.x applications.
Upvotes: 0