Пример #1
0
  private String getLogValue(WebLocator el, String value) {
    String info = el.getPathBuilder().getInfoMessage();
    if (info == null || "".equals(info)) {
      info = el.getPathBuilder().itemToString();
    }
    info = info.toLowerCase();

    return WebLocatorConfig.getLogParamsExclude().contains(info) ? "*****" : value;
  }
Пример #2
0
 public String getAttributeId(WebLocator el) {
   String pathId = getAttribute(el, "id");
   if (el.hasId()) {
     final String id = el.getPathBuilder().getId();
     if (!id.equals(pathId)) {
       LOGGER.warn("id is not same as pathId:{} - {}", id, pathId);
     }
     return id;
   }
   return pathId;
 }
Пример #3
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;
 }