Sign up ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free.

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.

share|improve this question

1 Answer 1

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");
webDriver.NgWaitFor(partialElement, "scope.IsBusyLoadingTemplate == false");

https://github.com/leblancmeneses/RobustHaven.IntegrationTests/blob/master/NgExtensions/NgWebDriverExtensions.cs

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)

https://github.com/leblancmeneses/RobustHaven.IntegrationTests

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.