June 20, 2007...1:23 pm
Selenium Testing with Prototype AJAX
Jump to Comments
If you are using Selenium to test your web application and you are having some AJAX in it, you may know that the waitForCondition assertion is your friend.
According to the Selenium documentation it:
Runs the specified JavaScript snippet repeatedly until it evaluates to “true”.
With this you can define your own condition which defines the end of an AJAX call.
Since I am using Prototypes AJAX mostly, I found this standard waitForCondition quite helpful:
| waitForCondition | selenium.browserbot.getCurrentWindow().Ajax.activeRequestCount==0 | 30000 |
It waits until all ongoing AJAX calls are done and then continues. While this might not be suitable for all places it is definitively better than using the pause command.
1 Comment
July 31, 2007 at 5:03 pm
Great tip thanks!
Leave a Reply