Some of the sites I deal with have heavy ajax requests. I plan to wait for Ajax request completion before clicking for asserting for element. Currently I use
If you are using JSONP requests, you need to enable the active handling:
jQuery.ajaxPrefilter(function( options ) {
options.global = true;
});
I think that the use of active
is correct, but possibly the way you have used might return false in the instanceof
conditions.
Optionally, see another way to wait for jQuery ajax calls using active in Selenium tests:
browser.wait_for_condition("selenium.browserbot.getCurrentWindow().jQuery.active === 0;", '30000')