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

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

Introduction

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

Prototype

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

Source Link

Document

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

Usage

From source file:com.hotwire.selenium.desktop.us.billing.car.impl.ccf.CcfPaymentMethodFragment.java

License:Open Source License

public WebElement getSavedVisaButton() {
    return new WebDriverWait(getWebDriver(), 3)
            .until(ExpectedConditions.visibilityOfElementLocated(By.id(idSavedVisaBtn)));
}

From source file:com.hotwire.selenium.desktop.us.billing.car.impl.ccf.CcfPaymentMethodFragment.java

License:Open Source License

public WebElement getSavedMasterCardButton() {
    return new WebDriverWait(getWebDriver(), 3)
            .until(ExpectedConditions.visibilityOfElementLocated(By.id(idSavedMCBtn)));

}

From source file:com.hotwire.selenium.desktop.us.billing.onepage.HotelTravelerInfoFragment.java

License:Open Source License

public void clickSignInLink() {
    signInLink.click();//w  w w .j a  v a2s  .c  om
    new WebDriverWait(getWebDriver(), DEFAULT_WAIT)
            .until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector(SIGN_IN_MODULE)));
}

From source file:com.hotwire.selenium.desktop.us.results.air.ExpediaAirMultiResultsPage.java

License:Open Source License

private void waitForLoadedResults() {

    WebDriverWait wait = new WebDriverWait(getWebDriver(), 60);
    wait.until(ExpectedConditions.visibilityOfElementLocated(By.name("flightLegSummary")));
}

From source file:com.hotwire.selenium.desktop.us.results.ExpediaAirResultsPage.java

License:Open Source License

private void waitForLoadedResults() {

    WebDriverWait wait = new WebDriverWait(getWebDriver(), 60);
    wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//li[@id='flightModule0']")));
}

From source file:com.hotwire.selenium.desktop.us.search.HotelSearchFragment.java

License:Open Source License

/**
 * Wait for autocomplete visibility state.
 *
 * @param state The state to wait for, either visible or invisible.
 *///from  w  w  w .j a va  2 s .co  m
public void waitForLocationAutocompleteVisibilityState(AutocompleteVisibilityState state) {
    boolean visibility = state.equals(AutocompleteVisibilityState.VISIBLE);
    if (isJQueryLocationAutocomplete()) {
        new WebDriverWait(getWebDriver(), MENU_VISIBLE_WAIT, SLEEP_INTERVAL_MILLIS)
                .until(PageObjectUtils.webElementVisibleTestFunction(
                        cssSelector("ul.ui-autocomplete, div[id='intlHomeFareFinder'] .where ul"), visibility));
    } else {
        By by = cssSelector(FARE_FINDER_AUTOCOMPLETE_CONTENT_BLOCK);
        new WebDriverWait(getWebDriver(), MENU_VISIBLE_WAIT, SLEEP_INTERVAL_MILLIS)
                .until(ExpectedConditions.visibilityOfElementLocated(by));
    }
}

From source file:com.hotwire.selenium.mobile.search.HotelSearchFragment.java

License:Open Source License

public HotelSearchFragment withDestinationLocation(AbstractMap.SimpleEntry<String, String> coordinates) {
    hotelLocation.click();// w w  w  .  j  av a 2  s  . c o m

    new WebDriverWait(getWebDriver(), TIME_OUT_IN_SECONDS)
            .until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("div.cloak")));

    getWebDriver().findElement(By.cssSelector("td.location-true")).click();

    StringBuilder stringBuilder = new StringBuilder();
    stringBuilder.append("navigator.geolocation.getCurrentPosition = ")
            .append("function(success) { success({coords: {latitude: ");

    stringBuilder.append(coordinates.getKey());
    stringBuilder.append(", longitude: ");
    stringBuilder.append(coordinates.getValue());
    stringBuilder.append("}}); }");
    JavascriptExecutor javascriptExecutor = (JavascriptExecutor) getWebDriver();
    javascriptExecutor.executeScript(stringBuilder.toString());

    return this;
}

From source file:com.hotwire.selenium.mobile.search.HotelSearchFragment.java

License:Open Source License

public List<String> getSearchSuggestions(String destinationLocation) {
    List<String> searchSuggestions = new ArrayList<String>();
    hotelLocation.click();//  w  w  w .j  a v  a 2s .com

    new WebDriverWait(getWebDriver(), TIME_OUT_IN_SECONDS)
            .until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("div.cloak")));

    hotelLocation.clear();
    hotelLocation.sendKeys(destinationLocation);

    new WebDriverWait(getWebDriver(), TIME_OUT_IN_SECONDS)
            .until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("tr.ng-scope")));

    for (WebElement e : getWebDriver().findElements(By.cssSelector("form[name='destinations'] td"))) {
        searchSuggestions.add(e.getText());
    }

    hotelLocation.submit();

    new WebDriverWait(getWebDriver(), TIME_OUT_IN_SECONDS)
            .until(ExpectedConditions.invisibilityOfElementLocated(By.cssSelector("div.cloak")));

    searchSuggestions.remove(0);
    return searchSuggestions;
}

From source file:com.hotwire.selenium.tools.c3.overcharges.C3SearchOverchargesPage.java

License:Open Source License

public void selectSearchByParam(String searchBy) {
    Select select = new Select(new WebDriverWait(getWebDriver(), 5)
            .until(ExpectedConditions.visibilityOfElementLocated(By.id("searchBy"))));
    select.selectByVisibleText(searchBy);
}

From source file:com.hotwire.selenium.tools.c3.overcharges.C3SearchOverchargesPage.java

License:Open Source License

public void selectSearchPeriod(String period) {
    Select select = new Select(new WebDriverWait(getWebDriver(), 5)
            .until(ExpectedConditions.visibilityOfElementLocated(By.id("lastDateModifiedPeriod"))));
    select.selectByVisibleText(period);//from   w ww.  j a  v a2s  .  c  om
}