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

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

Introduction

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

Prototype

public static ExpectedCondition<WebElement> visibilityOf(final WebElement element) 

Source Link

Document

An expectation for checking that an element, known to be present on the DOM of a page, is visible.

Usage

From source file:com.hotwire.test.steps.about.us.AboutUsModelWebApp.java

License:Open Source License

/**
 * Verify Company links//from ww w.j  a v a 2s.  c  o m
 */
@Override
public void verifyCompanyLinks() {
    AboutUsPage aboutUs = new AboutUsPage(getWebdriverInstance());
    // verify company mission link
    aboutUs.getcompanyMissionLink().click();
    WebDriverWait wait = new WebDriverWait(getWebdriverInstance(), DEFAULT_WAIT);

    wait.until(ExpectedConditions.visibilityOf(aboutUs.getcompanyOverviewText()));

    // verify leadership team link
    aboutUs.getawardsLink().click();
    wait.until(ExpectedConditions.visibilityOf(aboutUs.getawardsText()));

    // verify contact us link
    aboutUs.getcontactUsLink().click();
    wait.until(ExpectedConditions.visibilityOf(aboutUs.getcontactUsText()));
}

From source file:com.hotwire.test.steps.about.us.AboutUsModelWebApp.java

License:Open Source License

/**
 * Verify Legal links//from   w w  w  .j  a  v a 2s .  co  m
 */
@Override
public void verifyLegalLinks() {

    WebDriverWait wait = new WebDriverWait(getWebdriverInstance(), DEFAULT_WAIT);
    AboutUsPage aboutUs = new AboutUsPage(getWebdriverInstance());
    // verify Terms of use
    aboutUs.gettermsOfUseLink().click();
    wait.until(ExpectedConditions.visibilityOf(aboutUs.gettermsOfUseText()));

    // verify privacy policy
    aboutUs.getprivacyPolicyLink().click();
    wait.until(ExpectedConditions.visibilityOf(aboutUs.getprivacyPolicyText()));

    // verify cookie policy
    aboutUs.getcookiePolicyLink().click();
    wait.until(ExpectedConditions.visibilityOf(aboutUs.getcookiePolicyText()));

    // verify rules and restrictions
    aboutUs.getruleRestrictionsLink().click();
    wait.until(ExpectedConditions.visibilityOf(aboutUs.getruleRestrictionsText()));

    // verify low price guarantee
    aboutUs.getlowPriceLink().click();
    wait.until(ExpectedConditions.visibilityOf(aboutUs.getlowPriceText()));

}

From source file:com.hotwire.test.steps.about.us.AboutUsModelWebApp.java

License:Open Source License

/**
 * Verify Hotel Partner Overview Link//w  ww. j  a v a  2 s .  c om
 */
@Override
public void verifyHotelPartnerOverviewLink() {
    WebDriverWait wait = new WebDriverWait(getWebdriverInstance(), DEFAULT_WAIT);
    AboutUsPage aboutUs = new AboutUsPage(getWebdriverInstance());

    // verify hotel partner link
    aboutUs.gethotelPartnerOverviewLink().click();
    wait.until(ExpectedConditions.visibilityOf(aboutUs.gethotelPartnerOverviewLinkText()));

}

From source file:com.hotwire.test.steps.about.us.AboutUsModelWebApp.java

License:Open Source License

/**
 * Verify Press Releases Link/*  w  w w  .  j a  v  a2 s.c om*/
 */
@Override
public void verifyPressReleaseLink() {
    WebDriverWait wait = new WebDriverWait(getWebdriverInstance(), DEFAULT_WAIT);
    AboutUsPage aboutUs = new AboutUsPage(getWebdriverInstance());

    aboutUs.getpressRoomOverviewLinks().click();
    wait.until(ExpectedConditions.visibilityOf(aboutUs.getpressRoomOverviewTexts()));

    aboutUs.getpressReleasesLink().click();
    wait.until(ExpectedConditions.visibilityOf(aboutUs.getpressReleasesText()));

    aboutUs.getnewsAlertsLink().click();
    wait.until(ExpectedConditions.visibilityOf(aboutUs.getnewsAlertsText()));

}

From source file:com.hotwire.test.steps.about.us.AboutUsModelWebApp.java

License:Open Source License

/**
 * Verify Affiliates Link//from w w w.java2  s .c o m
 */
@Override
public void verifyAffiliatesLink() {
    WebDriverWait wait = new WebDriverWait(getWebdriverInstance(), DEFAULT_WAIT);
    AboutUsPage aboutUs = new AboutUsPage(getWebdriverInstance());

    aboutUs.getaffiliatesOverviewLink().click();
    wait.until(ExpectedConditions.visibilityOf(aboutUs.getaffiliatesOverviewText()));

    aboutUs.getfAQLink().click();
    wait.until(ExpectedConditions.visibilityOf(aboutUs.getfAQText()));

}

From source file:com.hotwire.test.steps.search.hotel.HotelSearchModelTemplate.java

License:Open Source License

@Override
public void verifyLocationOnResultsPage(String location) {
    HotelResultsPage hotelResultsPage = new HotelResultsPage(getWebdriverInstance());
    WebDriverWait waitForLocation = new WebDriverWait(getWebdriverInstance(), 30);
    try {/*from   w w  w .jav  a  2  s .  c o m*/
        waitForLocation.until(ExpectedConditions.visibilityOf(hotelResultsPage.getDestinationNameElement()));
        logger.info("The destination name element is visible");
    } catch (TimeoutException e) {
        logger.error(e.getMessage());
    }
    assertThat(hotelResultsPage.getDestinationName()).as("Location on results page as expected")
            .startsWith(location);
}

From source file:com.ibm.watson.app.qaclassifier.selenium.FirstTimeUserHelpIT.java

License:Open Source License

@Test
public void verifyPopupIsVisibleAndCloses() {

    CommonFunctions.askQuestionViaTextInput(driver, SampleQuestions.HIGH_CONFIDENCE);

    // Popups are animated, so we have to wait for them
    new WebDriverWait(driver, 5).until(ExpectedConditions.visibilityOf(driver.findElement(By.id("popup"))));

    assertTrue("The popup is visible upon initial home screen load",
            driver.findElement(By.id("popup")).isDisplayed());

    driver.findElement(By.id("close")).click();

    CommonFunctions.reload(driver);/*  w  ww .  j  ava 2 s.  co m*/
    CommonFunctions.askQuestionViaTextInput(driver, SampleQuestions.HIGH_CONFIDENCE);

    assertFalse("The popup is not visible upon reload", driver.findElement(By.id("popup")).isDisplayed());
}

From source file:com.ibm.watson.app.qaclassifier.selenium.MenuMobileIT.java

License:Open Source License

@Test
public void clickOnMenuOptionShowsContent() {
    WebElement menuIconImg = driver.findElement(By.className("menuIconImg"));
    WebElement menuList = driver.findElement(By.className("menu-list"));
    WebElement menuContent = driver.findElement(By.className("menu-content"));
    // Click the menu icon, it should show the menu list
    menuIconImg.click();//w w w.j  av  a  2 s.  co  m

    //Get list of menu options
    List<WebElement> menuOptions = menuList.findElements(By.xpath(".//ul/li"));
    WebElement firstMenuOption = menuOptions.get(2); // Get content of "About" option that has content
    firstMenuOption.click();

    new WebDriverWait(driver, 1).until(ExpectedConditions.visibilityOf(menuContent));
    assertTrue("After clicking on the menu option, the menu option content is displayed",
            menuContent.isDisplayed());
}

From source file:com.ionidea.RegressionNGA.Tests.ArtistInformation.java

@Test

//Verify that page contains all static UI elemtns
public void elementsExistBiography() throws InterruptedException {

    //Initiate new page (+widget)
    ArtistInformationPage artistInformationPage = new ArtistInformationPage(driver);
    WidgetBiographyPage widget = new WidgetBiographyPage(driver);
    //move to the URL of test page
    artistInformationPage.openPageWidget(artistInformationPage, m_baseUrl, artistInformationPage.biographyLink);
    m_wait.until(ExpectedConditions.visibilityOf(widget.biographyTitle));

    //Test static objects of Main page
    artistInformationPage.assertElementIsPresent(driver, artistInformationPage.onlineEditions);
    artistInformationPage.assertElementIsPresent(driver, artistInformationPage.nameBreadCrumb);
    artistInformationPage.assertElementIsPresent(driver, artistInformationPage.nameTitle);
    artistInformationPage.assertElementIsPresent(driver, artistInformationPage.descriptionName);
    artistInformationPage.assertElementIsPresent(driver, artistInformationPage.descriptionDate);
    artistInformationPage.assertElementIsPresent(driver, artistInformationPage.artistImage);
    artistInformationPage.assertElementIsPresent(driver, artistInformationPage.citeLink);
    artistInformationPage.assertElementIsPresent(driver, artistInformationPage.pdfLink);
    artistInformationPage.assertElementIsPresent(driver, artistInformationPage.archivedVersionsLink);
    artistInformationPage.assertElementIsPresent(driver, artistInformationPage.searchInputField);
    artistInformationPage.assertElementIsPresent(driver, artistInformationPage.biographyLink);
    artistInformationPage.assertElementIsPresent(driver, artistInformationPage.worksOfArtLink);
    artistInformationPage.assertElementIsPresent(driver, artistInformationPage.artistBibliographyLink);
    System.out.println("all static elements are displayed");

    //Test the objects of #Biography 
    artistInformationPage.assertTextIsPresent(driver, widget.biographyTitle, "BIOGRAPHY");
    artistInformationPage.assertTextIsPresent(driver, widget.textBegin,
            "Nicolaes Berchem was one of the most popular and successful Italianate landscape painters of his day. Aside from views of Italy, his extensive oeuvre of paintings, drawings, and etchings consists of depictions of the hunt and biblical and mythological scenes. Born in Haarlem in 1620, Berchem received his early training under his father, the still-life painter Pieter Claesz (Dutch, 1596/1597 - 1660). Houbraken, however, enumerated other teachers, including Jan van Goyen (Dutch, 1596 - 1656), Claes Moeyaert (15911655), Pieter de Grebber (c. 16001652/1653), Jan Wils (c. 16001666), and, somewhat improbably, Berchems younger cousin Jan Baptist Weenix (16211660/1661).");
    artistInformationPage.assertTextIsPresent(driver, widget.theAuthorName, "Arthur K. Wheelock Jr.");
    artistInformationPage.assertTextIsPresent(driver, widget.dateOfArticle, "April 24, 2014");
}

From source file:com.ionidea.RegressionNGA.Tests.ArtistInformation.java

@Test

public void elementsExistBibliography() throws InterruptedException {

    //Initiate new page (+widget)
    ArtistInformationPage artistInformationPage = new ArtistInformationPage(driver);
    WidgetBibliographyPage widget = new WidgetBibliographyPage(driver);

    //move to the URL of test page
    artistInformationPage.openPageWidget(artistInformationPage, m_baseUrl,
            artistInformationPage.artistBibliographyLink);
    m_wait.until(ExpectedConditions.visibilityOf(widget.bibliographyLabel));

    //Verify all static  elements of the page
    artistInformationPage.assertTextIsPresent(driver, widget.bibliographyLabel, "BIBLIOGRAPHY");
    System.out.println("the label is displayed");

    //Add all text elements to array
    String years[][] = new String[10][2];
    years[0][0] = "1753";
    years[0][1] = "Houbraken, Arnold. De Groote Schouburgh der Nederlantsche Konstschilders en Schilderessen. 3 vols. in 1. The Hague, 1753 (Reprint: Amsterdam, 1976): 2:109-114.";

    years[1][0] = "1958";
    years[1][1] = "Schaar, Eckhard. Studien zu Nicolaes Berchem. Cologne, 1958.";

    years[2][0] = "1978";
    years[2][1] = "Blankert, Albert. Nederlandse zeventiende eeuwse Italianiserende landschapschilders. Revised and enlarged ed. Exh. cat. Centraal Museum, Utrecht. Soest, 1978: 147-171.";

    years[3][0] = "1987";
    years[3][1] = "Sutton, Peter C., et al. Masters of Seventeenth-Century Dutch Landscape Painting. Exh. cat. Rijksmuseum, Amsterdam; Museum of Fine Arts, Boston; Philadelphia Museum of Art. Boston, 1987: 262-268.";

    years[4][0] = "1990";
    years[4][1] = "Dupare, Frederik J., and Linda L. Graif. Italian Recollections: Dutch Painters of the Golden Age. Exh. cat. The Montreal Museum of Fine Arts. Montreal, 1990: 55-78.";

    years[5][0] = "1991";
    years[5][1] = "MacLaren, Neil. The Dutch School, 1600-1900. Revised and expanded by Christopher Brown. 2 vols. National Gallery Catalogues. London, 1991: 1:19-20.";

    years[6][0] = "1995";
    years[6][1] = "Wheelock, Arthur K., Jr. Dutch Paintings of the Seventeenth Century. The Collections of the National Gallery of Art Systematic Catalogue. Washington, D.C., 1995: 22.";

    years[7][0] = "1998";
    years[7][1] = "Wuestman, Gerdien. Berchem in Prent: Tekenvoorbeeld, Kunstwerk of Bron? Verschuivingen in Functie en Betekenis van Reproduktiegrafiek.? In De Hollandse Schilderschool in Prent. Studies naar Reproduktiegrafiek in de Tweede Helft van de Zeventiende Eeuw. Ph.D. diss., Universiteit Utrecht, 1998: 59-102.";

    years[8][0] = "2006";
    years[8][1] = "Van Thiel-Stroman, Irene. \"Nicolaes Pietersz Berchem.\" In Painting in Haarlem 1500-1850: The Collection of the Frans Hals Museum. Edited by Pieter Biesboer and Neeltje Khler. Translated by Jennifer Kilian and Katy Kist. Ghent, 2006: 102-105.";

    years[9][0] = "2007";
    years[9][1] = "Biesboer, Pieter. \"Nicolaes Berchem, Matre de Haarlem.\" L'Estampille--L'objet d'art 421 (2007): 28-37.";

    //Verify all found static web elemnts contain respective text
    int x = 0;// ww  w  .ja  va  2s  .c  om
    while (x < 10) {
        artistInformationPage.assertTextIsPresent(driver, widget.yearLabel.get(x), years[x][0]);
        System.out.println("The element verified: " + widget.yearLabel.get(x));
        artistInformationPage.assertTextIsPresent(driver, widget.yearDescriptionLabel.get(x), years[x][1]);
        System.out.println("The element verified: " + widget.yearDescriptionLabel.get(x));
        x++;

    }
}