Example usage for org.openqa.selenium WebElement click

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

Introduction

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

Prototype

void click();

Source Link

Document

Click this element.

Usage

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

License:Apache License

/**
 * Finds the given menu item and then clicks it
 * @param cmi The item to click/*from  www  .  j  a  v  a  2  s  .c om*/
 */
public void clickMenuItem(ContextMenuItem cmi) {
    List<WebElement> items = menuUI.findElements(By.tagName("a"));
    for (WebElement item : items) {
        if (item.getText().equals(cmi.getDisp())) {
            item.click();
            return;
        }
    }
}

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 . j  a  v  a 2  s  . c  o 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

/**
 * Click the bulk tag based on the tag name provided.
 *
 * @param  tagName  tag name to be clicked.
 *//*ww  w .  j av a2s .  c  o  m*/
public void clickOnTagCloudTagElement(String tagName) {
    WebElement tagCloudDivElement = getTagCloudTagDivElement(tagName);
    tagCloudDivElement.click();
    SeleniumWaiter.waitTill(BULK_TAG_CLICK_WAIT);
}

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

License:Apache License

/**
 * Click on delete tag option and wait for the tag element to get removed.
 *
 * @param  tagName  Name of the tag element.
 *///from   ww w  . ja v a2 s  .c o  m
public void clickOnTagDeleteOptionAndConfirmDeletion(String tagName) {
    WebElement deleteDivTagElement = getTagDeleteDivElement(tagName);
    deleteDivTagElement.click();
    seleniumWaiter.waitForAlertPresence(TAG_DELETION_ALERT_PRESENCE_TIMEOUT);

    // Switching to alert and accepting it.
    Alert alert = driver.switchTo().alert();
    alert.accept();
    seleniumWaiter.waitForStaleness(deleteDivTagElement, TAG_DELETION_TIMEOUT);
}

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

License:Apache License

/**
 * Click the set-top filter row./*from w w  w  . ja v a2s . co m*/
 *
 * @param  stbId  tag name to be clicked.
 */
public void clickOnStbFilterTableRow(String stbId) {

    WebElement settopFilterRow = getStbFilterDivRowElement(stbId);
    settopFilterRow.click();

}

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

License:Apache License

/**
 * Select the set-top checkbox.//w w w  .  j  a  va 2  s  .  com
 *
 * @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

/**
 * Select all of the stb check boxes./*www  .  j a v  a 2  s  .  c  o m*/
 */
public void selectAllStbCheckbox() {
    WebElement toggleButton = getToggleAllCheckboxElement();

    if (!toggleButton.isSelected()) {
        toggleButton.click();
    }
}

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

License:Apache License

/**
 * Selecting an already available capability check box on loaded model overlay.
 *
 * @param  capability  Capability to be selected.
 *//*from www  .j a  va 2s  .  c o  m*/
private void selectCapabilityOnAlreadyLoadedModelOverlay(String capability) {
    WebElement capabilityCheckBox = getCapabilityElementOnAlreadyLoadedModelOverlay(capability);

    if (capabilityCheckBox.isSelected()) {
        capabilityCheckBox.click();
    }
}

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

License:Apache License

/**
 * Click on model delete element./*from w  w  w. ja v a  2 s.  co m*/
 *
 * @param  modelName  Name of the model to be clicked for deletion.
 */
public void clickOnModelDeleteElement(String modelName) {
    WebElement trElement = getStbModelTrElement(modelName);
    WebElement deleteButton = trElement.findElement(By.cssSelector(DELETE_BUTTON_TD_IDENTIFIER));
    deleteButton.click();
}

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

License:Apache License

/**
 * Click on add model button to launch add model page.
 *///from w w  w  .ja va2s  .co  m
public void clickOnAddModelButton() {
    WebElement addModelButton = driver.findElementByXPath(ADD_MODEL_BUTTON_INPUT_XPATH);

    // Clicking on add button.
    addModelButton.click();

    // Wait for the dialog box to get loaded.
    SeleniumWaiter.waitTill(MODEL_DIALOG_BOX_WAIT);
}