Steve French Steve French - 1 year ago 148
Ajax Question

How to wait until all ajax requests are complete in Selenium IDE?

I have a rather ajax-heavy web application that I am testing with Selenium, and Selenium IDE. Everything works fine until the final submit. Usually it errors out due to the outstanding number of ajax requests that are still in process (usually around 20). Is there any way to have selenium wait for all ajax requests to be complete? I have tried waitForEval Value = "$.active==0" (pictured below) but that doesn't seem to do anything enter image description here

Is this something that is possible with Selenium IDE?

Note - I do have to use the IDE due to the fact that the business types and I are passing the scripts back and forth.

Answer Source

The answer turned out to be rather simple - all you have to do is check the number of active requests (selenium.browserbot.getUserWindow().$.active) with the waitForEval command, and set the value to 0 - and it all happens in the ide.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download