How to wait for all http calls to be done in selenium for Angular?

Viewed 65

For angularjs I would do something like this to wait for all http calls to finish:

has_no_pending_requests_script = """var injector = window.angular.element('body').injector(); 
                var $http = injector.get('$http'); 
                return ($http.pendingRequests.length === 0);""" 
        wait = WebDriverWait(self.driver, max_time)
        wait.until(lambda d: self.driver.execute_script(has_no_pending_requests_script))

but for Angular, it throws me an error, and I think its because window.angular only exists for Angularjs. Can someone help me with an alternative? Thanks!

0 Answers
Related