Example usage for org.openqa.selenium.support.ui WebDriverWait WebDriverWait

List of usage examples for org.openqa.selenium.support.ui WebDriverWait WebDriverWait

Introduction

In this page you can find the example usage for org.openqa.selenium.support.ui WebDriverWait WebDriverWait.

Prototype

public WebDriverWait(WebDriver driver, Duration timeout) 

Source Link

Document

Wait will ignore instances of NotFoundException that are encountered (thrown) by default in the 'until' condition, and immediately propagate all others.

Usage

From source file:com.github.seleniumpm.webelements.Element.java

License:Apache License

public Element waitForVisible(long waitTime) {
    WebDriverWait wait = new WebDriverWait(driver, waitTime);
    wait.until(ExpectedConditions.visibilityOfElementLocated(locator));
    return this;
}

From source file:com.github.seleniumpm.WebPage.java

License:Apache License

public WebPage waitForTitle(String title) {
    final String ftitle = title.toLowerCase();
    (new WebDriverWait(driver, TimeUnit.MILLISECONDS.toSeconds(elementWaitTime)))
            .until(new ExpectedCondition<Boolean>() {
                public Boolean apply(WebDriver d) {
                    return d.getTitle().toLowerCase().startsWith(ftitle);
                }//from  w  w w .j  av a2s. c om
            });
    return this;
}

From source file:com.github.wasiqb.coteafs.appium.device.DeviceActions.java

License:Apache License

/**
 * @author wasiq.bhamla/* w  w w  . jav  a 2  s. c  o m*/
 * @param device
 * @param actions
 * @since 26-Apr-2017 8:39:17 PM
 */
public DeviceActions(final E device, final T actions) {
    this.device = device;
    this.actions = actions;
    this.driver = this.device.getDriver();
    this.setting = device.setting.getPlayback();
    this.wait = new WebDriverWait(this.driver, this.setting.getWaitForElementUntil());
}

From source file:com.github.wasiqb.coteafs.appium.device.DeviceActivity.java

License:Apache License

/**
 * @author wasiq.bhamla//  w w  w .j  a  v a 2s .co m
 * @param device
 * @param touch
 * @since 26-Apr-2017 4:32:45 PM
 */
public DeviceActivity(final E device, final T touch) {
    this.device = device;
    this.touch = touch;
    this.deviceElements = new HashMap<>();
    this.deviceSetting = device.getSetting();
    this.automation = this.deviceSetting.getAutomationName();
    this.platform = this.deviceSetting.getPlatformType();
    this.playSetting = this.deviceSetting.getPlayback();
    this.wait = new WebDriverWait(device.getDriver(), this.playSetting.getWaitForElementUntil());
}

From source file:com.github.wiselenium.elements.page.Page.java

License:Open Source License

@Override
public WebDriverWait waitFor(long timeOutInSeconds) {
    return new WebDriverWait(this.driver, timeOutInSeconds);
}

From source file:com.googlesites.LoginPage.java

public Sites clickNext() {

    Sites sites = new Sites(driver);
    if (driver.findElement(By.id("next")) != null) {

        driver.findElement(By.id("next")).click();
        driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
        WebDriverWait wait = new WebDriverWait(driver, 5);
        wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("Passwd")));

    }/*from w  w w. ja v a  2  s . co  m*/
    return sites;
}

From source file:com.googlesites.Site.java

public void clickOnButton(String buttonLabel) {

    driver.findElement(By.id(SAVE_CANCEL_BUTTONS.replace("@buttonName@", buttonLabel.toLowerCase()))).click();
    if (buttonLabel.equals("Save")) {

        WebDriverWait wait = new WebDriverWait(driver, 5);
        wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(SITE_NOTICE)));
    }//from w  ww  .j a va  2s.c  o  m
    driver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS);
}

From source file:com.grok.utils.ReusableTests.java

License:Open Source License

public static void testSetUpProgressText(WebDriver driver) throws InterruptedException {
    WebDriverWait wait = new WebDriverWait(driver, WAIT_TIME);
    String str = wait.until(ExpectedConditions.presenceOfElementLocated(SETUP_PROGRESS_TEXT)).getText();
    Assert.assertEquals(str, "Setup Progress:");
}

From source file:com.grok.utils.TestUtilities.java

License:Open Source License

public static void waitClick(By locator, WebDriver driver, int value) {
    WebDriverWait wait = new WebDriverWait(driver, WAIT_TIME);
    wait.until(ExpectedConditions.presenceOfElementLocated(locator));
    JavascriptExecutor executor = (JavascriptExecutor) driver;
    executor.executeScript("arguments[0].click();", driver.findElement(locator));
}

From source file:com.grok.utils.TestUtilities.java

License:Open Source License

public static String waitGetText(By locator, WebDriver driver, int value) {
    WebDriverWait wait = new WebDriverWait(driver, WAIT_TIME);
    return wait.until(ExpectedConditions.presenceOfElementLocated(locator)).getText();
}