We are running Webrat with Selenium2.0 aka WebDriver in our application.
WebDriver handles page reloading very well and do not start next steps if the browser is reloading entire page. The problem is that this mechanism doesn't work with Ajax requests. WebDriver doesn't do any idle when there some after click() or change().
Can anyone suggest how to make webdriver idle until the end of all ajax requests on the page?
Best Answer
We ended up writing a layer over selenium that handled this scenario by wrapping the calls in an optional loop. So when you'd do:
it would do something similar to what AutomatedTester suggested above:
the wrapper also did other things, like allowing to search by the button/input label etc. (so the wrapper didn't only exist for the timing issues, this was just one of the things we put in there.)