We use Selenium WebDriver to automate our interface-based tests. One of our tasks is to detect when the page really loaded, and Angular 1 was a problem in this regard. We ended up executing this piece of code to determine if Angular 1 was executed:
if(typeof window.angular !== \"undefined\") { var injector = window.angular.element(\"*[ng-app]\").eq(0).injector(); if(injector) { var $rootScope = injector.get(\"$rootScope\"); var $http = injector.get(\"$http\"); if($rootScope.$$phase === \"$apply\" || $rootScope.$$phase === \"$digest\" || $http.pendingRequests.length !== 0) { return false; } } }
The application we are testing has recently switched to using Angular 2. The code snippet above does not wait for Angular 2 to finish. Any suggestions?
angular selenium webdriver
user1801355
source share