Example usage for org.openqa.selenium.support.ui ExpectedConditions presenceOfElementLocated

List of usage examples for org.openqa.selenium.support.ui ExpectedConditions presenceOfElementLocated

Introduction

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

Prototype

public static ExpectedCondition<WebElement> presenceOfElementLocated(final By locator) 

Source Link

Document

An expectation for checking that an element is present on the DOM of a page.

Usage

From source file:com.hotwire.selenium.tools.c3.refund.C3AirRefundPage.java

License:Open Source License

@Override
public void fillPartialRefundValues() {
    new WebDriverWait(getWebDriver(), 5)
            .until(ExpectedConditions.presenceOfElementLocated(By.id(departSection + "0"))).click();
    new WebDriverWait(getWebDriver(), 5)
            .until(ExpectedConditions.presenceOfElementLocated(By.id(returnSection + "0"))).click();
}

From source file:com.hotwire.selenium.tools.c3.refund.C3AirRefundPage.java

License:Open Source License

@Override
public void fillPartialRefundValues(Integer numberOfSegment) {
    new WebDriverWait(getWebDriver(), 5)
            .until(ExpectedConditions.presenceOfElementLocated(By.id(departSection + (numberOfSegment - 1))))
            .click();//from w  w  w  . j  av a 2s .  c o  m
    new WebDriverWait(getWebDriver(), 5)
            .until(ExpectedConditions.presenceOfElementLocated(By.id(returnSection + (numberOfSegment - 1))))
            .click();
}

From source file:com.hotwire.selenium.tools.c3.refund.C3AirRefundPage.java

License:Open Source License

public void fillPartialRefundValues(String segment, String passengers) {
    String nameOfSegment = null;//from www  .  j  a v  a 2  s. c o m

    if ("depart".equals(segment)) {
        nameOfSegment = "outbound";
    } else if ("return".equals(segment)) {
        nameOfSegment = "inbound";
    }

    if ("first".equals(passengers)) {
        new WebDriverWait(getWebDriver(), 5)
                .until(ExpectedConditions.presenceOfElementLocated(By.id(nameOfSegment + "0"))).click();
    } else if ("second".equals(passengers)) {
        new WebDriverWait(getWebDriver(), 5)
                .until(ExpectedConditions.presenceOfElementLocated(By.id(nameOfSegment + "1"))).click();
    } else if ("both".equals(passengers)) {
        for (int i = 0; i < 2; i++) {
            new WebDriverWait(getWebDriver(), 5)
                    .until(ExpectedConditions.presenceOfElementLocated(By.id(nameOfSegment + i))).click();
        }
    }

}

From source file:com.hotwire.selenium.tools.c3.refund.C3CarRefundPage.java

License:Open Source License

public void fillPartialRefundValues() {
    WebElement daysNum = new WebDriverWait(getWebDriver(), 1)
            .until(ExpectedConditions.presenceOfElementLocated(By.id("numberOfDays")));
    new Select(daysNum).selectByVisibleText("1");
}

From source file:com.hotwire.selenium.tools.myAccount.ChoseLocalSiteDropdown.java

License:Open Source License

public void selectCountry(String locale) {
    new WebDriverWait(getWebDriver(), 1)
            .until(ExpectedConditions.presenceOfElementLocated(By.partialLinkText(locale))).click();
}

From source file:com.hotwire.test.steps.helpcenter.OldHelpCenterModel.java

License:Open Source License

public void verifyLiveChart() {
    Assertions//from  ww  w .  j av a  2  s.c o  m
            .assertThat(new WebDriverWait(getWebdriverInstance(), 5)
                    .until(ExpectedConditions.presenceOfElementLocated(By.className("rightCol"))).isEnabled())
            .as("LiveChart module doesn't present").isTrue();
}

From source file:com.htm.RegistrationTest.java

License:Open Source License

public static void registrationDisabledNextButtonUsingBothCheckBoxes(WebDriver driver) throws Exception {
        WebDriverWait wait = new WebDriverWait(driver, WAIT_TIME);
        wait.until(ExpectedConditions.presenceOfElementLocated(REGISTRATION_TEXTBOX_EMAIL)).clear();
        wait.until(ExpectedConditions.presenceOfElementLocated(REGISTRATION_TEXTBOX_YOUR_NAME))
                .sendKeys("John Doe");
        wait.until(ExpectedConditions.presenceOfElementLocated(REGISTRATION_TEXTBOX_COMPANY)).sendKeys("Numenta");
        wait.until(ExpectedConditions.presenceOfElementLocated(REGISTRATION_TEXTBOX_EMAIL))
                .sendKeys("sghatage@numenta.com");
        /*/*  www  .  j av a  2s  .co  m*/
         * Below scenario is "DE-SELECTING both check-boxes" one by one and then
         * checking the save button is disabled or not.
         */
        TestUtilities.waitClick(REGISTRATION_ACCEPT_CHECKBOX, driver, WAIT_TIME);
        Assert.assertFalse(driver.findElement(REGISTRATION_SAVE_DISABLED).isEnabled(), "Next button is enabled");
        TestUtilities.waitClick(REGISTRATION_AUTHORIZE_CHECKBOX, driver, WAIT_TIME);
        Assert.assertFalse(driver.findElement(REGISTRATION_SAVE_DISABLED).isEnabled(), "Next button is enabled");
    }

From source file:com.htm.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:");
    }//  ww  w . j a v a  2  s .co  m

From source file:com.htm.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  w w  w. j  a  v a2s  . c o m*/

From source file:com.htm.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();
    }/*from ww w .j  a v a 2  s  .c om*/