Package org.openqa.selenium.support.ui

Examples of org.openqa.selenium.support.ui.WebDriverWait


  public void clickElementByXpath(String xpathLocator) {
    driver.findElement(By.xpath(xpathLocator)).click();
  }

  public WebElement waitForElementById(final String idLocator) {
    return new WebDriverWait(driver, 5).until(new ExpectedCondition<WebElement>() {
      public WebElement apply(WebDriver d) {
        return d.findElement(By.id(idLocator));
      }
    });
  }
View Full Code Here


      }
    });
  }

  public WebElement waitForElementByXpath(final String xpathLocator) {
    return new WebDriverWait(driver, 5).until(new ExpectedCondition<WebElement>() {
      public WebElement apply(WebDriver d) {
        return d.findElement(By.xpath(xpathLocator));
      }
    });
  }
View Full Code Here

        actions.moveToElement(webElement);
        actions.perform();
    }

    private WebDriverWait webDriverWait() {
        return new WebDriverWait(webDriver, TestParameters.TIME_OUT_IN_SECONDS);
    }
View Full Code Here

        return elements;
    }

    private WebElement doFindElement() {
        if (timeout > 0) {
            return new WebDriverWait(webDriver, timeout)
                    .until(ExpectedConditions.presenceOfElementLocated(by));
        } else {
            return webDriver.findElement(by);
        }
    }
View Full Code Here

        }
    }

    private List<WebElement> doFindElements() {
        if (timeout > 0) {
            return new WebDriverWait(webDriver, timeout)
                    .until(ExpectedConditions.presenceOfAllElementsLocatedBy(by));
        } else {
            return webDriver.findElements(by);
        }
    }
View Full Code Here

public class Utils {

    private static WebDriver driver = BasePage.driver;

    public static void waitForElementPresent(String xpath) {
        WebDriverWait wait = new WebDriverWait(driver, 10);
        WebElement element = wait.until(
                ExpectedConditions.visibilityOfElementLocated(By.xpath(xpath)));
    }
View Full Code Here

          // Check the title of the page
          logger.info("Page title is: " + driver.getTitle());
         
          // Google's search is rendered dynamically with JavaScript.
          // Wait for the page to load, timeout after 10 seconds
          (new WebDriverWait(driver, 10)).until(new ExpectedCondition<Boolean>() {
              public Boolean apply(WebDriver d) {
                  return d.getTitle().toLowerCase().startsWith("cheese"); //Somehow, Chrome doesn't receive the '!'...
              }
          });
View Full Code Here

   * @return TRUE caso tenha localizado o menu do usuário e FALSE caso contrário.
   */
  public boolean menuUsuarioVisivel() {
    boolean resultado = false;
    try {
      WebDriverWait wait = new WebDriverWait(Webdriver.obterInstancia(), 15);
      wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("userSideNavBar")));
      resultado = true;
    } catch (Exception e) {
      resultado = false;
    }
    return resultado;
View Full Code Here

   * @throws Exception
   */
  void testAutoLogin(String loginUrl, String loginLoadedLinkText, String logoutLinkText) throws Exception
  {
    driver.get(loginUrl);
    WebDriverWait wait = new WebDriverWait(driver, getTimeout());
    // wait for Login, but we are not gonna click it testing AUTOACCEPT works.
    // TODO fix assumption that all sites have a direct Login page, but not all do. 
    if (loginLoadedLinkText != null &&  !loginLoadedLinkText.equals(""))
    {
      wait.until(ExpectedConditions.elementToBeClickable(By.linkText(loginLoadedLinkText)));
    }
    else
    {
      wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("/html")));
    }

    screenshot(); // of given loginUrl
   
    // various in page login pop-ups are detected by MP and can be submitted without clicking the link
    // that makes them visible.
    // TODO handle the other cases
    if (loginLoadedLinkText != null &&  !loginLoadedLinkText.equals(""))
    {
      wait.until(ExpectedConditions.elementToBeClickable(By.linkText(loginLoadedLinkText)));
    }

    Thread.sleep(1000);

    if (logoutLinkText != null &&  !logoutLinkText.equals(""))
    {
      WebElement logout = wait.until(ExpectedConditions.elementToBeClickable(By.linkText(logoutLinkText)));
//      logout.click(); // clicking log out is nearly useless, MP will log back in immediately with AUTOACCEPT
    }
    else
    {
      wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("/html")));
    }
    screenshot();
  }
View Full Code Here

      public Boolean apply(WebDriver driver) {
        WebElement notification = driver.findElements(By.id("notification")).get(0);
        return notification.getText().equals("Configuration Saved");
      }
    };
    WebDriverWait wait = new WebDriverWait(driver, 10);
    wait.until(isSaved);
  }
View Full Code Here

TOP

Related Classes of org.openqa.selenium.support.ui.WebDriverWait

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.