Example usage for org.openqa.selenium By className

List of usage examples for org.openqa.selenium By className

Introduction

In this page you can find the example usage for org.openqa.selenium By className.

Prototype

public static By className(String className) 

Source Link

Document

Find elements based on the value of the "class" attribute.

Usage

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

License:Open Source License

public HWGlobalHeader(WebDriver webDriver) {
    super(webDriver, By.className("hwGlobalHeader"));
}

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

License:Open Source License

public HWMyTrips(WebDriver webdriver) {
    super(webdriver, By.className("bookedTrips"));
}

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

License:Open Source License

public Last5DigitsSignInFragment(WebDriver webdriver) {
    super(webdriver, By.className("tripFinderModule"));
}

From source file:com.hotwire.selenium.tools.travelAdvisory.TravelAdvisoryUpdatesPage.java

License:Open Source License

public TravelAdvisoryUpdatesPage(WebDriver webDriver) {
    super(webDriver, By.className("formPrimaryHeader"));
}

From source file:com.hotwire.test.steps.deals.DealsModelWebApp.java

License:Open Source License

@Override
public void chooseTheFirstLinkFromAllCitiesAndVerifyLocationAndURL(String vertical) {
    InformationPageUS informationPageUS = new InformationPageUS(getWebdriverInstance());
    ArrayList<WebElement> destinationUrls = informationPageUS.getDestinationUrlsWebElements(vertical);
    ArrayList<String> destinationUrlsText = informationPageUS.getDestinationUrls(vertical);
    String firstLocationFromAllCities = destinationUrls.get(0).getText();
    destinationUrls.get(0).click();/*from  w ww  .  j  a va  2 s .  c o  m*/

    if ("car".equals(vertical)) {
        CarSearchFragment carSearchFragment = new CarSearchFragment(getWebdriverInstance(),
                By.name("searchCar"));
        String[] location = carSearchFragment.getStartLocation().getAttribute("value").split(",");
        assertThat(firstLocationFromAllCities.contains(location[0]))
                .as("Pre-populated location contains: " + location[0]).isTrue();
        assertThat(firstLocationFromAllCities.contains(location[1]))
                .as("Pre-populated location contains: " + location[1]).isTrue();
    } else if ("flight".equals(vertical)) {
        throw new UnimplementedTestException("Implement Me!");
    } else if ("hotel".equals(vertical)) {
        HotelSearchFragment hotelSearchFragment = new HotelSearchFragment(getWebdriverInstance(),
                By.className("landingFareFinder"));
        String[] location = hotelSearchFragment.getDestCity().getAttribute("value").split(",");
        assertThat(firstLocationFromAllCities.contains(location[0]))
                .as("Pre-populated location contains: " + location[0]).isTrue();
        assertThat(firstLocationFromAllCities.contains(location[1]))
                .as("Pre-populated location contains: " + location[1]).isTrue();

        hotelSearchFragment.getDestCity().clear();
    }

    assertThat(destinationUrlsText.get(0).split("\\?")[0].equals(getWebdriverInstance().getCurrentUrl()))
            .as("Current URL is correct: " + getWebdriverInstance().getCurrentUrl()).isTrue();

}

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

License:Open Source License

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

From source file:com.hotwire.test.steps.search.car.CarSearchModelRowWebApp.java

License:Open Source License

@Override
public void findFareOnResultsPage() {
    CarSearchFragment fareFinderOnResults = new CarSearchFragment(getWebdriverInstance(),
            By.className("carResultsFareFinder"));
    fillSearchParameters(fareFinderOnResults).clickSearchButton();
}

From source file:com.hotwire.test.steps.search.car.CarSearchModelRowWebApp.java

License:Open Source License

private void verificationDataOnFareFinder(CarSearchFragment fareFinderOnCLP) throws ParseException {
    //verify default value for driver's age parameter
    assertThat(fareFinderOnCLP.getDriversAge().equals(CarSearchFragment.DEFAULT_VALUE_FOR_DRIVERS_AGE));

    CarIntlSolutionModel solutionSetOnCLP = fareFinderOnCLP.getSolutionOptionsSet();
    setSolutionOptionsSetParameters(solutionSetOnCLP, fareFinderOnCLP);
    fareFinderOnCLP.clickSearchButton();
    CarSearchFragment fareFinderOnResults = new CarSearchFragment(getWebdriverInstance(),
            By.className("carResultsFareFinder"));
    CarIntlSolutionModel solutionSetOnResults = fareFinderOnResults.getSolutionOptionsSet();
    setSolutionOptionsSetParameters(solutionSetOnResults, fareFinderOnResults);
    carDataVerificationParameters.setOptionSetForSearch(solutionSetOnCLP);
    assertThat(solutionSetOnResults.match(solutionSetOnCLP));
}

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

License:Open Source License

@Override
public void verifyFareFinderDestination(String topDestination) {
    FareFinder fareFinder = new OldFareFinder(getWebdriverInstance(), By.className("landingFareFinder"));
    if (topDestination.contains("(")) {
        String[] strings = topDestination.split("\\(");
        assertThat(fareFinder.getDestinationLocation().contains(strings[0].trim())).isTrue();
        assertThat(fareFinder.getDestinationLocation().contains(strings[1].trim())).isTrue();
    } else {/*from www.j  a  va 2  s  .com*/
        assertThat(fareFinder.getDestinationLocation().contains(topDestination)).isTrue();
    }
}

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

License:Open Source License

@Override
public void launchSearch() {
    // make a hotel search from UHP page
    RefreshPageHandler.reloadPageIfDropdownSkinNotLoaded(getWebdriverInstance(),
            By.cssSelector(".numChildren span.ui-selectmenu-button a, "
                    + ".children span.ui-selectmenu-button a, #numChildren"));

    SearchParameters globalSearchParameters = searchParameters.getGlobalSearchParameters();
    String pageName = new PageName().apply(getWebdriverInstance());

    HotelSearchFragment hotelSearchFragment;

    if (pageName.contains("tile.hotel.geo.low.level")) {
        // tile.hotel.geo.low.level page
        hotelSearchFragment = new HotelSearchFragment(getWebdriverInstance(),
                By.className("landingFareFinder"));
    } else {//from w  w  w .  j a  va 2 s  . c  om
        hotelSearchFragment = new HotelSearchFragment(getWebdriverInstance()); // UHP page
    }

    hotelSearchFragment.getDestCity().sendKeys(globalSearchParameters.getDestinationLocation());
    hotelSearchFragment.selectStartDate(globalSearchParameters.getStartDate());
    hotelSearchFragment.selectEndDate(globalSearchParameters.getEndDate());
    hotelSearchFragment.selectHotelRooms(searchParameters.getNumberOfHotelRooms());
    hotelSearchFragment.selectHotelRoomAdults(searchParameters.getNumberOfAdults());
    hotelSearchFragment.withNumberOfChildren(searchParameters.getNumberOfChildren());
    hotelSearchFragment.withEnableSearchPartner(hotelSearchParameters.getEnableHComSearch());
    hotelSearchFragment.launchSearch();
}