Exemplo n.º 1
0
 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;
 }
Exemplo n.º 2
0
 public List<WebElement> findElements(WebLocator el) {
   return driver.findElements(el.getSelector());
 }