Created
December 24, 2015 00:41
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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