Selenium (and Selenium-like products) made automated testing of traditional web applications easy. All you need is to simulate a user session and Selenium IDE creates macros for you. "clickAndWait " works perfectly when navigating to another page, but there is no "AndWait" for AJAX...
Let's simply make it synchronous.
And the ideal scenario would be the following:
- Test, application itself or the in-browser testing framework raises a flag to mark the current session as the one of automated testing.
- AJAX framework detects the flag and passes to synchronous mode.
- User action simulation (click/type) of Selenium will not return until the AJAX data is successful fetched and processed.
So Selenium will not be able to continue before the page content is updated, and it's exactly what the user expects from his macros.
Author suggests using session cookie to inform the underlying AJAX framework to switch between sync/async modes.
He also suggests to choose a common cookie name (for ajax frameworks and in-browser testing solutions) to make this problem transparent for the end users.
The entire article can be found here : http://jroller.com/page/verySimpleSolutions?entry=sjax_ajax_option_for_automated