Skip to content

Instantly share code, notes, and snippets.

View FranAguiar's full-sized avatar

Francisco Aguiar FranAguiar

View GitHub Profile
@priyanshus
priyanshus / Wait.java
Created September 4, 2015 07:07
Wait until angular finishes $http calls in Selenium webdriver
/**
* Sometime it happens while automating the angular app, view gets loaded entirely but performing any action
* on that view fails the test. This could happen because angular $http calls are still pending in backend.
* We can have explicit wait in this way to ensure that angular has made all the $http calls.
* Wait until angular finishes the $http calls while loading the view
*/
public void waitForAngular() {
final String javaScriptToLoadAngular =
"var injector = window.angular.element('body').injector();" +
"var $http = injector.get('$http');" +