Skip to content

Instantly share code, notes, and snippets.

@sayems
Created December 24, 2015 00:41
Show Gist options
  • Select an option

  • Save sayems/ad9dfa96b12f88a6dbf9 to your computer and use it in GitHub Desktop.

Select an option

Save sayems/ad9dfa96b12f88a6dbf9 to your computer and use it in GitHub Desktop.
It checks if the JQuery is active or not and wait till it is active.
Boolean isJqueryUsed = (Boolean)((JavascriptExecutor)driver).executeScript("return (typeof(jQuery) != 'undefined')"));
if(isJqueryUsed){
while (true){
// JavaScript test to verify jQuery is active or not
Boolean ajaxIsComplete = (Boolean)(((JavascriptExecutor)driver).executeScript("return jQuery.active == 0"));
if (ajaxIsComplete) break;
try{
Thread.sleep(100);
}catch (InterruptedException e) {}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment