Example usage for org.openqa.selenium By tagName

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

Introduction

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

Prototype

public static By tagName(String tagName) 

Source Link

Usage

From source file:com.hotwire.selenium.desktop.account.AccountEmailSubscriptionsFormFragment.java

License:Open Source License

private void addToSubscriptionMap(WebElement row) {
    boolean isSubscribed = isSubscribed(row);
    String description = row.findElement(By.className("description")).findElement(By.tagName("strong"))
            .getText();/*from  ww  w.  j  a v a  2s  . c  om*/
    subscriptionMap.put(description, isSubscribed);
}

From source file:com.hotwire.selenium.desktop.seo.DestinationListPage.java

License:Open Source License

public String getSelectedCountryFromDropdownList() {
    WebElement selectedCountry = null;//  w  ww  .j  a v a 2 s . c  o m
    for (WebElement country : countrySelect.findElements(By.tagName("option"))) {
        if (country.isSelected()) {
            selectedCountry = country;
        }
    }
    return (selectedCountry == null) ? null : selectedCountry.getText();
}

From source file:com.hotwire.selenium.desktop.seo.DestinationListPage.java

License:Open Source License

public ArrayList<String> getDestinationUrls() {
    ArrayList<String> hrefs = new ArrayList<>();
    List<WebElement> aTags = cityList.findElements(By.tagName("a"));
    for (WebElement aTag : aTags) {
        String href = aTag.getAttribute("href");
        hrefs.add(href);//from w ww. ja va2s.  com
    }
    return hrefs;
}

From source file:com.hotwire.selenium.desktop.seo.InformationPageUS.java

License:Open Source License

private ArrayList<WebElement> getColumnUrlsWebElements(boolean getLeftColumn, String vertical) {
    WebElement leftColumn = null;//from  w  w w.  j a v a  2 s  .  c  o m
    WebElement rightColumn = null;

    if ("hotel".equalsIgnoreCase(vertical)) {
        leftColumn = hotelLeftColumn;
        rightColumn = hotelRightColumn;
    } else if ("car".equalsIgnoreCase(vertical)) {
        leftColumn = carLeftColumn;
        rightColumn = carRightColumn;
    } else if ("flight".equalsIgnoreCase(vertical)) {
        leftColumn = flightLeftColumn;
        rightColumn = flightRightColumn;

    }

    ArrayList<WebElement> hrefs = new ArrayList<WebElement>();
    List<WebElement> aTags = null;
    try {
        if (getLeftColumn) {
            aTags = leftColumn.findElements(By.tagName("a"));

        } else {
            aTags = rightColumn.findElements(By.tagName("a"));
        }
    } catch (NoSuchElementException e) {
        e.printStackTrace();
    }

    if (null != aTags) {
        hrefs.addAll(aTags);
    }

    return hrefs;
}

From source file:com.hotwire.selenium.desktop.seo.InformationPageUS.java

License:Open Source License

public int getNumberOfStatesDisplayedInFlightsDestination() {
    return viewFlightsByDestinationList.findElements(By.tagName("li")).size();
}

From source file:com.hotwire.selenium.desktop.us.HomePage.java

License:Open Source License

public Map<String, String> selectHotelDeal() {
    Map<String, String> map = new HashMap<>();
    if (getWebDriver().findElements(By.cssSelector(".deals ul .deal")).size() > 0) {
        // New home page deals.
        WebElement deal = getWebDriver().findElement(By.cssSelector(".deals ul .deal"));
        map.put("price", deal.findElement(By.cssSelector(".description .price")).getText().trim());
        map.put("location", deal.findElement(By.cssSelector(".description .location")).getText().trim());
        map.put("rating", deal.findElement(By.cssSelector(".description .ratings")).getText().trim());
        if (new GlobalHeader(getWebDriver()).hasVerticalNavigationTabs()
                && deal.findElements(By.cssSelector(".description .savings")).size() > 0) {
            map.put("savings", deal.findElement(By.cssSelector(".description .savings")).getText().trim()
                    .split("\\s+")[0]);
        }/*from w  w w .java2 s  .  c  o m*/
        deal.findElement(By.tagName("a")).click();
        new HotelResultsPage(getWebDriver());
        return map;
    }
    WebElement tr = getWebDriver().findElement(By.cssSelector("table.hotel.dealsTable tbody tr"));
    for (WebElement td : tr.findElements(By.cssSelector("td"))) {
        map.put(td.getAttribute("class"), td.getText());
    }
    tr.click();
    return map;
}

From source file:com.hotwire.selenium.desktop.us.index.HotelIndexPage.java

License:Open Source License

public Map<String, String> selectHotelDeal() {
    Map<String, String> map = new HashMap<>();
    WebElement tr = hotelDeals.get(0);/*from   w w w  .ja  va 2  s  .c  om*/
    if (tr.getAttribute("class").contains("deal")) {
        // New happy home page deal module.
        map.put("price", tr.findElement(By.cssSelector(".description .price")).getText().trim());
        map.put("location", tr.findElement(By.cssSelector(".description .location")).getText().trim());
        map.put("rating", tr.findElement(By.cssSelector(".description .ratings")).getText().trim());
        if (currentlyOnDomesticSite() && tr.findElements(By.cssSelector(".description .savings")).size() > 0) {
            map.put("savings",
                    tr.findElement(By.cssSelector(".description .savings")).getText().trim().split("\\s+")[0]);
        }
        tr.findElement(By.tagName("a")).click();
        new HotelResultsPage(getWebDriver());
        return map;
    }
    for (WebElement td : tr.findElements(By.cssSelector("span"))) {
        map.put(td.getAttribute("class"), td.getText());
    }
    tr.click();
    return map;
}

From source file:com.hotwire.selenium.desktop.us.index.HotwireVacationsIndexPage.java

License:Open Source License

private boolean verifyExpediaPage() {
    try {//from www.j  av a  2s  .  com
        logger.info("Checking for globalHeader");
        if (!hotwireGLobalHeader.isDisplayed()) {
            expediaPageLoaded = false;
        }
    } catch (NoSuchElementException e) {
        List<WebElement> iframes = getWebDriver().findElements(By.tagName("iframe"));
        logger.info("Checking for iFrames on expedia's landing page");
        if (!(iframes.size() > 0)) {
            expediaPageLoaded = false;
        }
    }
    return expediaPageLoaded;
}

From source file:com.hotwire.selenium.desktop.us.results.hotel.fragments.filters.HotelResultsAreasFilteringTabPanelFragment.java

License:Open Source License

public String getLabelForFirstAreaCheckbox() {
    return areaCheckboxesList.get(getIndexOfFirstEnabledCheckbox()).findElement(By.tagName("label")).getText();
}

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

License:Open Source License

public void clickTripWatcherSpeedBump() {
    tripwatcherSpeedbump.findElement(By.tagName("a")).click();
}