Пример #1
0
 /**
  * Verifies if an element is visible. Continue with tests even if false.
  *
  * @param expression boolean expression to evaluate
  * @param msg message to log on failure
  */
 public void waitForVisible(WebElement elementToBeVisible) {
   Checks.notNull("elementToBeVisible", elementToBeVisible);
   try {
     wait.until(ExpectedConditions.visibilityOf(elementToBeVisible));
   } catch (Exception e) {
     Exceptions.chuck(e);
   }
 }
Пример #2
0
 /**
  * Wait for some number of seconds.
  *
  * @param seconds A number of seconds
  */
 public static void waitFor(double seconds) {
   Checks.nonNegative("seconds", seconds);
   if (seconds > 1000 * 60 * 60) {
     throw new Error(
         "I don't think you really want to wait for " + (seconds / 60000) + " minutes");
   }
   try {
     Thread.sleep((long) (seconds * 1000));
   } catch (InterruptedException ex) {
     Logger.getLogger(Utils.class.getName()).log(Level.INFO, "Exception waiting", ex);
   }
 }
Пример #3
0
 /**
  * Instantiate an object,using Selenium's PageFactory, and injecting any fields annotated with
  * @Inject by Guice.
  *
  * <p>This is useful if you have caused the browser page to refresh and you need to rebuild a
  * model of the window's page.
  *
  * @param <T> A type
  * @param type The object to create
  * @return A new instance of this type
  */
 public <T> T instantiate(Class<T> type) {
   Checks.notNull("type", type);
   T result = PageFactory.initElements(driver, type);
   deps.injectMembers(result);
   return result;
 }