public ContactsPage() {
   wait = DriverManager.getInstance().getWait();
   driver = DriverManager.getInstance().getDriver();
   PageFactory.initElements(driver, this);
   try {
     wait.withTimeout(3, TimeUnit.SECONDS).until(ExpectedConditions.visibilityOf(contactsTitle));
   } catch (WebDriverException e) {
     throw new WebDriverException(e);
   } finally {
     wait.withTimeout(15, TimeUnit.SECONDS);
   }
 }
 public OpportunitiesPage() {
   wait = DriverManager.getInstance().getWait();
   driver = DriverManager.getInstance().getDriver();
   PageFactory.initElements(driver, this);
   try {
     wait.withTimeout(TIMEOUT_MIN, TimeUnit.SECONDS)
         .until(ExpectedConditions.visibilityOf(opportunitiesTitle));
   } catch (WebDriverException e) {
     throw new WebDriverException(e);
   } finally {
     wait.withTimeout(TIMEOUT_NORMAL, TimeUnit.SECONDS);
   }
 }
  @Test
  public void myFirstGoogleTest() {
    driver.get("http://www.google.com");

    ((WebDriverWait) wait).withTimeout(60, TimeUnit.SECONDS);

    WebElement searchBox = driver.findElement(By.name("q"));
    searchBox.sendKeys("Cheese");

    WebElement navend = wait.until(navEndIsVisibleAndTitleContains("heese"));
  }
 private WebElement doWaitElement(final WebLocator el, final long millis) {
   WebDriverWait wait = new WebDriverWait(driver, 0, 100);
   wait.withTimeout(
       millis,
       TimeUnit.MILLISECONDS); // hack enforce WebDriverWait to accept millis (default is seconds)
   try {
     if (el.getPathBuilder().isVisibility()) {
       el.currentElement =
           wait.until(ExpectedConditions.visibilityOfElementLocated(el.getSelector()));
     } else {
       el.currentElement =
           wait.until(
               new ExpectedCondition<WebElement>() {
                 public WebElement apply(WebDriver driver1) {
                   return driver.findElement(el.getSelector());
                 }
               });
     }
   } catch (TimeoutException e) {
     el.currentElement = null;
   }
   return el.currentElement;
 }