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.tools.c3.overcharges.C3SearchOverchargesPage.java

License:Open Source License

public void clickSearch() {
    new WebDriverWait(getWebDriver(), 5).until(ExpectedConditions.visibilityOfElementLocated(By.name("Submit")))
            .click();
}

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

License:Open Source License

public void clickSearchForUnassigned() {
    new WebDriverWait(getWebDriver(), 5)
            .until(ExpectedConditions.visibilityOfElementLocated(By.id("searchForUnassigned"))).click();
}

From source file:com.hotwire.selenium.tools.c3.purchase.hotel.C3HotelResultsPage.java

License:Open Source License

public List<String> getResults() {
    ArrayList results = new ArrayList<String>();
    new WebDriverWait(getWebDriver(), 5)
            .until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("a.retail"))).click();

    List<WebElement> list = getWebDriver().findElements(By.cssSelector("a.hotelNameLink"));
    for (WebElement w : list) {
        System.out.println(w.getText());
        results.add(w.getText());//from  www. ja  va2 s  . c om
    }
    return results;
}

From source file:com.hotwire.test.steps.account.AccountAccessRowWebApp.java

License:Open Source License

@Override
public void accessAccountInformation() {
    new WebDriverWait(getWebdriverInstance(), 5)
            .until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector(".hwGlobalHeader")));
    GlobalHeader globalHeader = new GlobalHeader(getWebdriverInstance());
    globalHeader.navigateToMyAccount();/*from   w w w  . j  a  v  a  2  s .  c  o m*/
}

From source file:com.hotwire.test.steps.bex.BexAbstractModel.java

License:Open Source License

public void verifyTextOnPage(String message) {
    logSession("Try to find text on page - " + message);
    new WebDriverWait(getWebdriverInstance(), DEFAULT_WAIT).until(ExpectedConditions
            .visibilityOfElementLocated(By.xpath(String.format("//*[text()[contains(.,'%s')]]", message))));
}

From source file:com.hotwire.test.steps.bex.BexAbstractModel.java

License:Open Source License

public boolean verifyTextOnPageBoolean(String message) {
    logSession("Try to find text on page - " + message);
    try {/*from  w w w  . j  av a  2 s  .c  o  m*/
        new WebDriverWait(getWebdriverInstance(), DEFAULT_WAIT).until(ExpectedConditions
                .visibilityOfElementLocated(By.xpath(String.format("//*[text()[contains(.,'%s')]]", message))));
    } catch (Exception e) {
        return false;
    }
    return true;
}

From source file:com.hotwire.test.steps.bex.BexAbstractModel.java

License:Open Source License

public void verifyTextOnPopupPage(String message) {
    logSession("Try to find text on Popup page - " + message);
    switchToNewWindow();/*  w ww. j  av  a  2 s  .  com*/
    new WebDriverWait(getWebdriverInstance(), DEFAULT_WAIT).until(ExpectedConditions
            .visibilityOfElementLocated(By.xpath(String.format("//*[text()[contains(.,'%s')]]", message))));
    switchToDefaultWindow();
}

From source file:com.hotwire.test.steps.bex.BexAbstractModel.java

License:Open Source License

private String getCurrentFrameId() {
    String frameId;/*from   w w  w.  ja  va  2  s .c om*/
    try {
        new WebDriverWait(getWebdriverInstance(), DEFAULT_WAIT).until(
                ExpectedConditions.visibilityOfElementLocated(By.cssSelector("div.c3SingleColumnLayout")));
        frameId = "c3Frame";
    } catch (TimeoutException | NoSuchElementException | ElementNotVisibleException e) {
        frameId = "notesFrame";
    }
    return frameId;
}

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

License:Open Source License

public void switchSFAdminCategory(String category) {
    //Too many sub pages, that's why without page object's. Also this method will be used only for one scenario.
    new WebDriverWait(getWebdriverInstance(), 2)
            .until(ExpectedConditions.visibilityOfElementLocated(By.name("go"))).click();
    //Paste category name to xpath locator
    String editCategory = String.format(EDIT_CATEGORY_TEMP, category);
    new WebDriverWait(getWebdriverInstance(), 4)
            .until(ExpectedConditions.visibilityOfElementLocated(By.xpath(editCategory))).click();
    new WebDriverWait(getWebdriverInstance(), 2)
            .until(ExpectedConditions.visibilityOfElementLocated(By.name("save")));
    List<WebElement> checks = getWebdriverInstance().findElements(By.cssSelector("table.detailList input"));
    for (WebElement check : checks) {
        if (helpCenterInfo.getMode().equals(HelpCenterInfo.CONTACTS_MODE.ON)) {
            if (!check.isSelected()) {
                check.click();/*  w  ww  .ja  v a2 s  . c om*/
            }
        } else {
            if (check.isSelected()) {
                check.click();
            }
        }
    }
    getWebdriverInstance().findElement(By.name("save")).click();
}

From source file:com.hotwire.test.steps.tools.c3.purchase.C3HotelPurchaseModel.java

License:Open Source License

public void selectOpaqueResult() {
    new HotelResultsPage(getWebdriverInstance()).chooseOpaque();
    new WebDriverWait(getWebdriverInstance(), 15).until(
            ExpectedConditions.visibilityOfElementLocated(By.cssSelector("ul.results li.opaque a.detailsLink")))
            .click();/*  w  ww .ja  v  a 2  s .  c  o m*/
}