Example usage for org.openqa.selenium WebElement isSelected

List of usage examples for org.openqa.selenium WebElement isSelected

Introduction

In this page you can find the example usage for org.openqa.selenium WebElement isSelected.

Prototype

boolean isSelected();

Source Link

Document

Determine whether or not this element is selected or not.

Usage

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

License:Open Source License

public void uncheckFirstFilteringCheckbox() {
    WebElement checkbox = getFirstFilteringCheckboxElement();
    if (checkbox.isSelected()) {
        checkbox.click();// www  .ja va  2  s  .c  om
        doWaitForUpdatingLayer();
    }
}

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

License:Open Source License

public boolean checkCompareWithCheckboxState(String partnerName, String state) {

    try {/*from  ww w.j  ava 2 s  .  c  o m*/
        WebElement cb = getCompareWithCheckboxByPartnerName(partnerName);
        if (cb.isDisplayed() && !"hidden".equals(state)) {
            if ("checked".equals(state) && cb.isSelected()) {
                return true;
            }
            if ("unchecked".equals(state) && !cb.isSelected()) {
                return true;
            }
        }
    } catch (NoSuchElementException exception) {
        if ("hidden".equals(state)) {
            return true;
        }
    }
    return false;
}

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

License:Open Source License

public void checkComparableCarPartner(List<String> partners) {
    for (String p : partners) {
        WebElement cb = getCompareWithCheckboxByPartnerName(p.trim());
        if (!cb.isSelected()) {
            cb.click();/*from   w ww .j a v  a  2s. c  o m*/
        }
    }
}

From source file:com.hotwire.selenium.mobile.account.MobileAccountEmailSubscriptionsPage.java

License:Open Source License

private void updateSubscription(String subscription, Boolean stateOfSubscription) {
    WebElement subscriptionToUpdate = getSubscriptionCorrespondingToName(subscription);

    if ((stateOfSubscription && !subscriptionToUpdate.isSelected()) || // Check the box
            (!stateOfSubscription && subscriptionToUpdate.isSelected())) { // Uncheck the box
        subscriptionToUpdate.click();//from ww w  .ja v a2 s.c  o m
    }
}

From source file:com.hotwire.selenium.mobile.account.MobileAccountEmailSubscriptionsPage.java

License:Open Source License

public boolean isSubscribed(String subscriptionName) {
    WebElement subscriptionToCheck = getSubscriptionCorrespondingToName(subscriptionName);
    return subscriptionToCheck.isSelected();
}

From source file:com.hotwire.selenium.mobile.results.MobileHotelResultsMapPage.java

License:Open Source License

public void filterOutTopNeighborhood() {
    for (WebElement hood : neighborhoods) {
        if (hood.isSelected()) {
            hood.click();// ww w  .  j  a  v a 2s .c o  m
            break;
        }
    }
}

From source file:com.hotwire.selenium.mobile.results.MobileHotelResultsMapPage.java

License:Open Source License

public void filterOutAllNeighborhoods() {
    for (WebElement hood : neighborhoods) {
        if (hood.isSelected()) {
            hood.click();/*ww w.ja v a 2s.c  om*/
        }
    }
}

From source file:com.hotwire.selenium.mobile.results.MobileHotelResultsPage.java

License:Open Source License

public void sortByNeighborhood() {
    clickFliter();//from   w w w . j  av  a 2  s.c  om
    for (WebElement hood : neighborhoods) {
        if (hood.isSelected()) {
            hood.click();
            break;
        }
    }
    doneFliter.click();
}

From source file:com.hotwire.selenium.tools.c3.customer.C3CreateCustomerPage.java

License:Open Source License

public void setSubscription(boolean subscription) {
    WebElement checkbox = findOne(By.xpath("//input[@name='rocketNews']"));
    if (subscription) {
        if (!checkbox.isSelected()) {
            checkbox.click();/*from   ww  w  .j a v a  2s . c  om*/
        }
    } else {
        if (checkbox.isSelected()) {
            checkbox.click();
        }
    }
}

From source file:com.hotwire.selenium.tools.c3.purchase.car.C3CarTravellerFragment.java

License:Open Source License

public void confirmAgeAndDeposit() {
    List<WebElement> checkboxes = findMany("div.confirm25box input");
    for (WebElement checkbox : checkboxes) {
        if (checkbox.isDisplayed() && !checkbox.isSelected()) {
            checkbox.click();//from  w  w w  . j  a v a  2  s. c om
        }
    }
}