java - Can't implement waitForAngular to Selenium -


we use selenium webdriver , java our framework. need add waitforangular() method. @ first found source code of protractor:

var waitforangular = function(rootselector, callback) {     var el = document.queryselector(rootselector);     try {         if (window.getangulartestability) {             window.getangulartestability(el).whenstable(callback);             return;         }         if (!window.angular) {             throw new error('window.angular undefined. either ' +                 'because non-angular page or because test involves ' +                 'client-side navigation, can interfere protractor\'s ' +                 'bootstrapping. see http://git.io/v4gxm details');         }         if (angular.gettestability) {             angular.gettestability(el).whenstable(callback);         } else {             if (!angular.element(el).injector()) {                 throw new error('root element (' + rootselector + ') has no injector.' +                     ' may mean not inside ng-app.');             }             angular.element(el).injector().get('$browser').             notifywhennooutstandingrequests(callback);         }     } catch (err) {         callback(err.message);     } };  var rootselector = arguments[0];  var callback = arguments[1];  waitforangular(rootselector, callback); 

i injected in framework, using javascriptexecutor driver:

public void waitforangular() {     this.jsexecutor.executeasyncscript(         waitforangularjsscript, rootelement); } 

as rootelement tried use "body", "[ng-app]". doesn't work. have exception

error: ng:test testability not found no injector found element argument gettestability

link description of exception

in the:

angular.gettestability(el).whenstable(callback); 

i'm not strong in angular, maybe helpe me can find resolving.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -