Selenium wait_for_condition in Internet Explorer

I'm trying to get Selenium to wait for all AJAX requests on the page to complete before moving on to the next command. I am using the wait_for_condition

following JavaScript as well:

function(){
  var wait = function() { return jQuery.active == 0; }
  return wait.call(selenium.browserbot.getCurrentWindow());
}();

      

This works fine in Firefox, but doesn't work with timeout in IE.

Does anyone know why this might be or is there an alternative approach for waiting for the AJAX requests to complete?

+2


source to share


2 answers


How easy it is to use this simplified version:

selenium.browserbot.getCurrentWindow().jQuery.active == 0;

      



It sounds silly, but most IE problems are solved this way ...

If that doesn't work, you can analyze another alternative: http://www.markhneedham.com/blog/2009/05/14/selenium-waiting-for-jquery-ajax-calls/ But I'll live like the last plan, so how changing jquery to maintain a counter of ajax calls at the moment sounds a bit like overkill ...

+1


source


I found this advice in many blog posts, but mysteriously nobody says where this "selenium.browserbot.getCurrentWindow (). JQuery.active == 0;" have to go. It doesn't work if I put it in the waitForCondition parameter in the IDE. I am assuming it should go to user-extensions.js, but not as an anonymous function. I tried to put this in this file:

function wait_for_ajax(timeout){
  return selenium.browserbot.getCurrentWindow().jQuery.active == 0;
};

      



but it looks like a no-op (the following tests still don't work).

+1


source







All Articles