Saturday, 27 September 2014

Selenium WebDiver: Handle AJAX calls

The most common problem that we face during automation using Selenium WebDriver is how to handle AJAX calls. We never know when the call is complete and page has been updated. AJAX can be handled using JavaScript/JavascriptExecutor.

  In this post we will see how we can use JavaScript - jQuery.active to get all active AJAX calls and wait until all calls get served.

jQuery.active returns total number of active AJAX connections, and we are waiting until all active calls becomes zero or given Timeout reached.

Hope this helped you!!!