The code of wait method for Ajax call to complete



  • I am testing an GWT based app. But my test are failing left and right when the application response is slow but the selenium execution speed is fast. I have written a webdriver wait method to handle an element which loads after an Ajax call but that does not seem to be working as each time I have to figure out which element is appearing after the Ajax call. I need a generic Wait method which would wait till the Ajax call gets complete.



  • I have successfully used something similar to: new WebDriverWait(driver, 180)).until(new ExpectedCondition<Boolean>() { public Boolean apply(WebDriver driver) { JavascriptExecutor js = (JavascriptExecutor) driver; return (Boolean)js.executeScript("return jQuery.active == 0"); }};


Log in to reply
 

Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2