October 2018
Intermediate to advanced
192 pages
5h 12m
English
Let's have a look at few of the most common scenarios for JavascriptExecutor. All of the reusable methods are included in TestBase.java:
public static boolean docState() { docReady = ((JavascriptExecutor) driver) .executeScript("return document.readyState").toString() .equals("complete"); return docReady; }
public static boolean ajaxState() { int counter = 0; while (counter < 10) { ajaxIsComplete = (Boolean) ((JavascriptExecutor) driver) .executeScript("return jQuery.active == 0"); if (ajaxIsComplete) { break; } else { counter = counter + 1; } } return ajaxIsComplete; ...Read now
Unlock full access