Wednesday, 22 July 2015

How to make the web driver to wait for page to refresh before executing another test

code:
 
public void waitForPageLoaded(WebDriver driver) {

     ExpectedCondition<Boolean> expectation = new
ExpectedCondition<Boolean>() {
        public Boolean apply(WebDriver driver) {
          return ((JavascriptExecutor)driver).executeScript
            ("return document.readyState").equals("complete");
        }
      };

     Wait<WebDriver> wait = new WebDriverWait(driver,30);
      try {
              wait.until(expectation);
      } catch(Throwable error) {
              assertFalse("Timeout waiting for
       Page Load Request to complete.",true);
      }
 } 

Angular JS Protractor Installation process - Tutorial Part 1

                     Protractor, formally known as E2E testing framework, is an open source functional automation framework designed spe...