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

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

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

WebDriverWait.withMessage介绍

暂无

代码示例

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

@Override
public FluentWait<WebDriver, FLUENT> withMessage(String message) {
  wait.withMessage(message);
  return this;
}

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

@Override
public FluentWait<WebDriver, FLUENT> withMessage(String message) {
  wait.withMessage(message);
  return this;
}

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

public void waitUntilReady() {
     WebDriverWait waiter = new WebDriverWait(getWebDriver(), 30);
     waiter.withMessage("\"" + getElementName() + "\" is not ready in 30 seconds")
         .until(new Predicate<WebDriver>() {
           @Override
           public boolean apply(WebDriver input) {
             /* isReady() returns true if all elements 
              * that you need to test are available. 
              * Note that if you have javascript, you 
              * should have some hidden field to tell 
              * you that the whole page has loaded. */
             return isReady();
           }
         });
   }

代码示例来源:origin: org.eclipse.che.selenium/che-selenium-core

/**
 * Creates an instance of the {@link FluentWait} with specified {@code timeoutInSec} and error
 * message supplier.
 *
 * @param timeoutInSec waiting time in seconds.
 * @param messageSupplier error message supplier
 * @return
 */
public FluentWait<WebDriver> get(int timeoutInSec, Supplier<String> messageSupplier) {
 return new WebDriverWait(seleniumWebDriver, timeoutInSec).withMessage(messageSupplier);
}

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

WebDriverWait wait = new WebDriverWait(driver, timeout);
wait.withMessage("Any message you want");
wait.until(ExpectedConditions.titleIs(title));

代码示例来源:origin: org.kurento/kurento-test

public Object executeScriptAndWaitOutput(final String command) {
 WebDriverWait wait = new WebDriverWait(driver, timeout);
 wait.withMessage("Timeout executing script: " + command);
 final Object[] out = new Object[1];
 wait.until(new ExpectedCondition<Boolean>() {
  @Override
  public Boolean apply(WebDriver d) {
   try {
    out[0] = executeScript(command);
   } catch (WebDriverException we) {
    log.warn("Exception executing script", we);
    out[0] = null;
   }
   return out[0] != null;
  }
 });
 return out[0];
}

代码示例来源:origin: Kurento/kurento-java

public Object executeScriptAndWaitOutput(final String command) {
 WebDriverWait wait = new WebDriverWait(driver, timeout);
 wait.withMessage("Timeout executing script: " + command);
 final Object[] out = new Object[1];
 wait.until(new ExpectedCondition<Boolean>() {
  @Override
  public Boolean apply(WebDriver d) {
   try {
    out[0] = executeScript(command);
   } catch (WebDriverException we) {
    log.warn("Exception executing script", we);
    out[0] = null;
   }
   return out[0] != null;
  }
 });
 return out[0];
}

代码示例来源:origin: allure-examples/allure-junit-example

@Step
public void search(String text) {
  driver.findElement(By.id("text")).sendKeys(text);
  driver.findElement(By.className("suggest2-form__button")).submit();
  new WebDriverWait(driver, 10)
      .withMessage("Could not load results page")
      .until(mainContainLoaded());
}

代码示例来源:origin: ru.sbtqa.tag.pagefactory/page-factory-core

/**
   * Waits during the standard timeout for the condition specified by the {@link ExpectedCondition} parameter.
   * For example, to wait for an element to invisible by its locator {@code ExpectedConditions.invisibilityOfElementLocated (by)}
   *
   * @param condition check condition
   * @param message message in case verification failed
   * @param timeout condition timeout in seconds
   */
  public static void wait(ExpectedCondition condition, String message, int timeout) {
    new WebDriverWait(Environment.getDriverService().getDriver(), timeout)
        .withMessage(message).until(condition);
  }
}

代码示例来源:origin: ru.sbtqa.tag.pagefactory/page-factory-core

/**
 * Waits during the standard timeout for the condition specified by the {@link ExpectedCondition} parameter.
 * For example, to wait for an element to invisible by its locator {@code ExpectedConditions.invisibilityOfElementLocated (by)}
 *
 * @param condition check condition
 * @param message message in case verification failed
 */
public static void wait(ExpectedCondition condition, String message) {
  new WebDriverWait(Environment.getDriverService().getDriver(), PROPERTIES.getTimeout())
      .withMessage(message).until(condition);
}

相关文章