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.cengage.mindtap.keywords.CSMPageActions.java

public void editCapabilitiesTA() {
    waitForElementPresent("user_menu_link");
    clickOnElementUsingActionBuilder(element("user_menu_link"));
    clickOnElementUsingActionBuilder(element("course_settings_link"));
    waitForElementPresent("course_settings_title");
    clickOnElementUsingActionBuilder(element("inst_ta_expand"));
    waitTOSync();//from   www. j ava  2  s  .  co  m
    clickOnElementUsingActionBuilder(element("teach_assist_expand"));
    scrollDown(element("ta_manage_lpn_cap_chkbox"));
    List<WebElement> checkBoxes = new ArrayList();
    checkBoxes = elements("ta_capabilities_allchkboxes");
    for (WebElement box : checkBoxes) {
        if (box.isSelected()) {
            clickOnElementUsingActionBuilder(box);
        }
    }
    scrollDown(element("ta_grade_capability_chkbox"));
    clickOnElementUsingActionBuilder(element("save_permissions_btn"));
    waitTOSync();
    waitTOSync();
    clickOnElementUsingActionBuilder(element("csm_done_btn"));

}

From source file:com.chtr.tmoauto.webui.CommonFunctions.java

License:Open Source License

@Override
public void check(String locator) {
    WebElement e = findElement(locator);
    if (!e.isSelected()) {
        e.click();//from   w w w . j av  a 2 s  .  c o  m
    }
}

From source file:com.chtr.tmoauto.webui.CommonFunctions.java

License:Open Source License

@Override
public boolean isChecked(String locator) {
    WebElement e = findElement(locator, 1);
    return e.isSelected();
}

From source file:com.chtr.tmoauto.webui.CommonFunctions.java

License:Open Source License

@Override
public void uncheck(String locator) {
    WebElement e = findElement(locator);
    if (e.isSelected()) {
        e.click();//www  . j av a  2s  . co m
    }
}

From source file:com.citrix.g2w.webdriver.pages.BasePage.java

License:Open Source License

/**
 * Method to set the check box values.//from   w ww .j a v  a  2s . c  o  m
 *
 * @param checkBoxElement
 *            (element of check box)
 * @param check
 *            (boolean to select check box)
 */
public void setCheckBox(final WebElement checkBoxElement, final boolean check) {
    boolean isChecked = checkBoxElement.isSelected();
    if ((isChecked && !check) || (!isChecked && check)) {
        checkBoxElement.click();
    }
}

From source file:com.comcast.dawg.house.AdvanceFilterNavigator.java

License:Apache License

public void checkConditions(boolean check, String... conditionTexts) {
    WebElement conditionList = driver.findElementByClassName(IndexPage.CONDITION_LIST);
    List<WebElement> conditions = conditionList.findElements(By.tagName("div"));

    for (String conditionText : conditionTexts) {
        WebElement condition = getCondition(conditions, conditionText, true);
        WebElement conditionCheckBox = condition.findElement(By.className(IndexPage.CONDITION_CHECK_BOX));
        if (conditionCheckBox.isSelected() != check) {
            conditionCheckBox.click();// w w  w  .ja v  a2  s .c  o  m
        }
    }
}

From source file:com.comcast.dawg.house.EditDeviceOverlay.java

License:Apache License

/**
 * Adds a property by inputing the key and then clicking add
 * @param key The key to add/*from www .ja  v a  2 s. co  m*/
 * @param set true if the Set check mark should be checked
 * @param byButton true if the property is added by clicking the button, false if it is by pushing enter
 */
public void addProp(String key, boolean set, boolean byButton) {
    WebElement keyInp = overlayUI.findElement(By.className(NEW_PROP_KEY));
    keyInp.sendKeys(key);
    WebElement setCb = overlayUI.findElement(By.className(CB_NEW_PROP_SET));
    if (setCb.isSelected() != set) {
        setCb.click();
    }
    if (byButton) {
        overlayUI.findElement(By.className(BTN_ADD_PROP)).click();
    } else {
        keyInp.click();
        driver.getKeyboard().pressKey(Keys.ENTER);
    }
}

From source file:com.comcast.dawg.house.pages.IndexPage.java

License:Apache License

/**
 * Select the set-top checkbox./*from ww w . j a  v  a 2  s  .co  m*/
 *
 * @param  stbIds  ID of Set-top to be selected.
 */
public void selectStbCheckboxes(String... stbIds) {

    if (null == stbIds) {
        throw new IllegalArgumentException("STB id is null. No STB id is provided for selection.");
    }

    WebElement stbCheckbox = null;

    for (String stbId : stbIds) {

        stbCheckbox = getStbCheckboxElement(stbId);

        // For scrolling.
        ((JavascriptExecutor) driver).executeScript("window.scrollTo(0," + stbCheckbox.getLocation().y + ")");
        SeleniumWaiter.waitTill(STB_CHECKBOX_ELEMENT_WAIT);

        if (!stbCheckbox.isSelected()) {
            stbCheckbox.click();
            SeleniumWaiter.waitTill(STB_CHECKBOX_SELECTION_WAIT);
        }
    }
}

From source file:com.comcast.dawg.house.pages.IndexPage.java

License:Apache License

/**
 * Validate all the STB check box displayed to user is in selected state.
 *
 * @return  true if all the displayed STB check boxes are checked, false if any of the displayed
 *          STB check box is not checked or none of the STB displayed.
 */// ww  w  .  ja v  a2 s . c  om
public boolean isAllStbCheckboxesInFilteredTableSelected() {
    boolean isAllSelected = true;

    List<WebElement> listOfCheckboxes = getAllStbCheckboxesInFilteredTable();

    // Validation to see devices are displayed.
    if (null != listOfCheckboxes && listOfCheckboxes.size() > 0) {

        for (WebElement checkbox : listOfCheckboxes) {

            // If any of the check box not selected set false and break the loop.
            if (!checkbox.isSelected()) {
                isAllSelected = false;

                break;
            }
        }
    } else {

        // In case of no device displayed.
        isAllSelected = false;
    }

    return isAllSelected;
}

From source file:com.comcast.dawg.house.pages.IndexPage.java

License:Apache License

/**
 * Validate all the STB check box displayed to user is in deselected state.
 *
 * @return  true if all the displayed STB check boxes are checked, false if any of the displayed
 *          STB check box is in checked or no STB displayed.
 *///from w  w w  . ja va2s .c  o  m
public boolean isAllStbCheckboxesInFilteredTableDeselected() {
    boolean isAllDeselected = true;

    List<WebElement> listOfCheckboxes = getAllStbCheckboxesInFilteredTable();

    // Validation to see devices are displayed.
    if (null != listOfCheckboxes && listOfCheckboxes.size() > 0) {

        for (WebElement checkbox : listOfCheckboxes) {

            // If any of the check box is in selected state return false and break the loop.
            if (checkbox.isSelected()) {
                isAllDeselected = false;

                break;
            }
        }
    } else {

        // In case of no device displayed return false
        isAllDeselected = false;
    }

    return isAllDeselected;
}