Force Selenium to wait for AngularJS


How can I force python Selenium wait for a second until AngularJS completes page parsing and loads some stuff that it needs.

Or how can I force Selenium to wait for 1 second after button click, which causes ajax request to the server, handled by AngularJS. I need server side actions to take place before navigating to other page.

  • You must to post comments

Access AngularJS scope through Selenium – most likely that state is already held in Scope/IsolatedScope .

I built a few extensions to help with this that can be translated to python.

webDriver.NgWaitFor(productDiv, "scope.Data.Id != 0");
.NgWaitFor(partialElement, "scope.IsBusyLoadingTemplate == false");

to deal with ajax request when your working with both angularjs $http and jquery I use:

webDriver.WaitFor("window.isBrowserBusy() == false");

requires you to setup intercepts in both angularjs and jquery to manage the count of the xhr requests.

Here is the framework we are using in our project: (you might want to extract more pieces from it)

  • You must to post comments
Showing 1 result
Your Answer
Post as a guest by filling out the fields below or if you already have an account.