yashaka

ajaxCompleted expected condition

Jan 27th, 2017
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.65 KB | None | 0 0
  1. public static ExpectedCondition<Boolean> ajaxCompleted = new ExpectedCondition<Boolean>() {
  2.         boolean result;
  3.         @Override
  4.         public Boolean apply(WebDriver driver) {
  5.             try {
  6.                 result = (Boolean) ((JavascriptExecutor) driver).executeScript("return typeof($) !== 'undefined' && $.active == 0");
  7.                 System.out.println("Ajax return $.active == 0  is: '" + result + "'");
  8.             } catch (Exception e) {
  9.                 return false;
  10.             }
  11.             return result;
  12.         }
  13.  
  14.         public String toString() {
  15.             return "Ajax return $.active == 0  is: '" + result + "'";
  16.         }
Advertisement
Add Comment
Please, Sign In to add comment