org.openqa.selenium.support.ui.WebDriverWait.ignoring()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(7.5k)|赞(0)|评价(0)|浏览(164)

本文整理了Java中org.openqa.selenium.support.ui.WebDriverWait.ignoring()方法的一些代码示例,展示了WebDriverWait.ignoring()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebDriverWait.ignoring()方法的具体详情如下:
包路径:org.openqa.selenium.support.ui.WebDriverWait
类名称:WebDriverWait
方法名:ignoring

WebDriverWait.ignoring介绍

暂无

代码示例

代码示例来源:origin: arquillian/arquillian-graphene

@Override
public <K extends Throwable> FluentWait<WebDriver, FLUENT> ignoring(Class<? extends Throwable> exceptionType) {
  wait.ignoring(exceptionType);
  return this;
}

代码示例来源:origin: arquillian/arquillian-graphene

@Override
public <K extends Throwable> FluentWait<WebDriver, FLUENT> ignoring(Class<? extends Throwable> firstType,
  Class<? extends Throwable> secondType) {
  wait.ignoring(firstType, secondType);
  return this;
}

代码示例来源:origin: org.jboss.arquillian.graphene/graphene-webdriver-impl

@Override
public <K extends Throwable> FluentWait<WebDriver, FLUENT> ignoring(Class<? extends Throwable> exceptionType) {
  wait.ignoring(exceptionType);
  return this;
}

代码示例来源:origin: org.jboss.arquillian.graphene/graphene-webdriver-impl

@Override
public <K extends Throwable> FluentWait<WebDriver, FLUENT> ignoring(Class<? extends Throwable> firstType,
  Class<? extends Throwable> secondType) {
  wait.ignoring(firstType, secondType);
  return this;
}

代码示例来源:origin: stackoverflow.com

final public static boolean waitForElToBeRemove(WebDriver driver, final By by) {
  try {
    driver.manage().timeouts()
        .implicitlyWait(0, TimeUnit.SECONDS);

    WebDriverWait wait = new WebDriverWait(UITestBase.driver,
        DEFAULT_TIMEOUT);

    boolean present = wait
        .ignoring(StaleElementReferenceException.class)
        .ignoring(NoSuchElementException.class)
        .until(ExpectedConditions.invisibilityOfElementLocated(by));

    return present;
  } catch (Exception e) {
    return false;
  } finally {
    driver.manage().timeouts()
        .implicitlyWait(DEFAULT_TIMEOUT, TimeUnit.SECONDS);
  }
}

代码示例来源:origin: stackoverflow.com

final public static boolean waitForElToBeRemove(WebDriver driver, final By by) {
  try {
    driver.manage().timeouts()
        .implicitlyWait(0, TimeUnit.SECONDS);

    WebDriverWait wait = new WebDriverWait(UITestBase.driver,
        DEFAULT_TIMEOUT);

    boolean present = wait
        .ignoring(StaleElementReferenceException.class)
        .ignoring(NoSuchElementException.class)
        .until(ExpectedConditions.invisibilityOfElementLocated(by));

    return present;
  } catch (Exception e) {
    return false;
  } finally {
    driver.manage().timeouts()
        .implicitlyWait(DEFAULT_TIMEOUT, TimeUnit.SECONDS);
  }
}

代码示例来源:origin: io.github.aktoluna/slnarch-core

@Provides
@Singleton
@Named("frameWait")
public WebDriverWait provideWebDriverWaitByFrame(WebDriver driver, Configuration configuration) {
 WebDriverWait webDriverWait = new WebDriverWait(driver,
   configuration.getPageTimeOut(),
   configuration.getPollingTime() < 0 ? POLLING_TIME : configuration.getPollingTime());
 webDriverWait
   .ignoring(NoSuchElementException.class, StaleElementReferenceException.class);
 return webDriverWait;
}

代码示例来源:origin: paypal/SeLion

private static void waitForConditionIgnoring(ExpectedCondition<?> condition, Class<? extends Throwable> ignoring,
    long timeoutInSeconds) {
  new WebDriverWait(Grid.driver(), timeoutInSeconds).ignoring(ignoring).until(condition);
}

代码示例来源:origin: stackoverflow.com

WebDriverWait wait = new WebDriverWait(driver, 10);
   wait.ignoring(NoSuchElementException.class);
   final String testName = "";
   final WebElement wsearchlist = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("")));
   WebElement wsearch = wait.until(new Function<WebDriver, WebElement>() {
     public WebElement apply(WebDriver input) {
       By by = new By.ByLinkText(testName);
       WebElement search = null;
       search = wsearchlist.findElement(by);
       return search;
     }}); 
   //Continue on.

代码示例来源:origin: io.github.aktoluna/slnarch-core

@Provides
@Singleton
@Named("default")
public WebDriverWait provideWebDriverWait(WebDriver driver, Configuration configuration) {
 WebDriverWait webDriverWait = new WebDriverWait(driver,
   configuration.getExplicitTimeOut() < 0 ? EXPLICIT_TIME
     : configuration.getExplicitTimeOut(),
   configuration.getPollingTime() < 0 ? POLLING_TIME : configuration.getPollingTime());
 webDriverWait
   .ignoring(NoSuchElementException.class, StaleElementReferenceException.class);
 return webDriverWait;
}

代码示例来源:origin: qaprosoft/carina

/**
 * Wait until any condition happens.
 *
 * @param condition - ExpectedCondition.
 * @param timeout - timeout.
 * @return true if condition happen.
 */
public boolean waitUntil(ExpectedCondition<?> condition, long timeout) {
  boolean result;
  final WebDriver drv = getDriver();
  Timer.start(ACTION_NAME.WAIT);
  Wait<WebDriver> wait = new WebDriverWait(drv, timeout, RETRY_TIME).ignoring(WebDriverException.class)
      .ignoring(NoSuchSessionException.class);
  try {
    wait.until(condition);
    result = true;
    LOGGER.debug("waitUntil: finished true...");
  } catch (NoSuchElementException | TimeoutException e) {
    // don't write exception even in debug mode
    LOGGER.debug("waitUntil: NoSuchElementException | TimeoutException e..." + condition.toString());
    result = false;
  } catch (Exception e) {
    LOGGER.error("waitUntil: " + condition.toString(), e);
    result = false;
  }
  Timer.stop(ACTION_NAME.WAIT);
  return result;
}

代码示例来源:origin: qaprosoft/carina

Wait wait = new WebDriverWait(webDriver, timeout, RETRY_TIME).ignoring(WebDriverException.class)
    .ignoring(NoSuchSessionException.class);
try {

代码示例来源:origin: bedatadriven/activityinfo

public void waitUntil(Predicate<WebDriver> predicate, int timeInSeconds) {
  WebDriverWait wait = new WebDriverWait(webDriver, timeInSeconds);
  wait.ignoring(StaleElementReferenceException.class);
  wait.until(new java.util.function.Function<WebDriver, Boolean>() {
    @Override
    public Boolean apply(WebDriver webDriver) {
      return predicate.apply(webDriver);
    }
  });
}

代码示例来源:origin: bedatadriven/activityinfo

public <T> T waitFor(Function<WebDriver, T> function) {
  WebDriverWait wait = new WebDriverWait(webDriver, TIMEOUT_SECONDS);
  wait.ignoring(StaleElementReferenceException.class);
  return wait.until(function);
}

代码示例来源:origin: bedatadriven/activityinfo

public <T> void waitUntil(ExpectedCondition<T> condition) {
  WebDriverWait wait = new WebDriverWait(webDriver, TIMEOUT_SECONDS);
  wait.ignoring(StaleElementReferenceException.class);
  wait.until(condition);
}

代码示例来源:origin: org.jsystemtest/webdriver-so

/**
 * Asserts that all {@link ElementMustExist}s fields are visible in this
 * page object.
 */
@Override
protected void assertInModule() {
  driver.manage().timeouts().implicitlyWait(pollingMillis, TimeUnit.MILLISECONDS);
  for (final Field currField: this.getClass().getDeclaredFields()) {
    currField.setAccessible(true);
    if (currField.isAnnotationPresent(ElementMustExist.class)) {
      By by = new Annotations(currField).buildBy();
      report.report("Waiting for Element (@ElementMustExist): " + by);
      final WebDriverWait wait = new WebDriverWait(driver, getAjaxTimeout());
      wait.ignoring(WebDriverException.class);
      wait.pollingEvery(100, TimeUnit.MILLISECONDS);
      wait.until(ExpectedConditions.visibilityOfElementLocated(by));
    }
  }
}

代码示例来源:origin: qaprosoft/carina

Wait<WebDriver> wait = new WebDriverWait(drv, timeout, RETRY_TIME).ignoring(WebDriverException.class)
    .ignoring(NoSuchSessionException.class);

代码示例来源:origin: bedatadriven/activityinfo

public FluentElement waitFor(By by, int timeout) {
  WebDriverWait wait = new WebDriverWait(webDriver, timeout);
  wait.ignoring(StaleElementReferenceException.class);
  WebElement element = wait.until(ExpectedConditions.presenceOfElementLocated(by));
  return new FluentElement(webDriver, element);
}

代码示例来源:origin: paypal/SeLion

wait.ignoring(NoSuchElementException.class);
wait.ignoring(PageValidationException.class);
Object expectedObj = wait.ignoring(ExpectOneOfException.class).until(new Function<WebDriver, Object>() {

代码示例来源:origin: paypal/SeLion

wait.ignoring(NoSuchElementException.class);
wait.ignoring(ExpectOneOfException.class);

相关文章