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.comcast.dawg.house.AdvanceFilterNavigator.java

License:Apache License

/**
 * Helper method to verify if a button is enabled
 * @param parent The parent of the button
 * @param className The class name used to look it up in the parent
 * @param enabled true if the button should be enabled, false if it should be disabled
 *///from w ww  . j  av  a 2 s  .  co  m
private void assertEnabled(SearchContext parent, String className, boolean enabled) {
    WebElement btn = parent.findElement(By.className(className));
    Assert.assertEquals(btn.isEnabled(), enabled);
}

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

License:Apache License

/**
 * Helper method to look up a button by classname and then click it
 * @param className The name of the class of the button to click
 *///from   www. j  a  v a  2s  . co m
private void btn(String className) {
    conditionControl.findElement(By.className(className)).click();
}

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

License:Apache License

private void performSearchAndCheckDevices(RemoteWebDriver driver, String[] deviceIdsToHave,
        String[] deviceIdsNotToHave) {
    WebElement filteredTable = driver.findElementByClassName(IndexPage.FILTERED_TABLE);

    WebDriverWait wait = new WebDriverWait(driver, 20);
    driver.findElementByClassName(IndexPage.BTN_SEARCH).click();

    /** Need two waits... first for the original table to be removed from the DOM, then for it
     * to be present again *///from   ww  w  . ja  va  2s .c o  m
    wait.until(ExpectedConditions.stalenessOf(filteredTable));
    wait.until(ExpectedConditions.presenceOfElementLocated(By.className(IndexPage.FILTERED_TABLE)));
    filteredTable = driver.findElementByClassName(IndexPage.FILTERED_TABLE);

    if (deviceIdsToHave != null) {
        hasDevices(filteredTable, deviceIdsToHave, true);
    }
    if (deviceIdsNotToHave != null) {
        hasDevices(filteredTable, deviceIdsNotToHave, false);
    }
}

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

License:Apache License

/**
 * Clicks the Edit menu item and then waits for the Edit Overlay to be visible
 * @return//from   w w w  .  j a v a2 s. c  o  m
 */
public EditDeviceOverlay launchEditDeviceOverlay() {
    clickMenuItem(ContextMenuItem.edit);
    WebDriverWait wait = new WebDriverWait(driver, 20);
    WebElement overlay = driver.findElement(By.className(EDIT_DEVICE_OVERLAY));
    wait.until(ExpectedConditions.visibilityOf(overlay));
    return new EditDeviceOverlay(driver, overlay);
}

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   ww  w  . j a  va  2  s  . c  om*/
 * @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.EditDeviceOverlay.java

License:Apache License

/**
 * Clicks the Save button
 */
public void save() {
    overlayUI.findElement(By.className(BTN_SAVE)).click();
}

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

License:Apache License

/**
 * Clicks the X icon to close the overlay
 *//*  w w  w  . j a  va 2  s. c  om*/
public void close() {
    WebElement dialog = overlayUI.findElement(By.xpath(".."));
    dialog.findElement(By.className(CLOSE_ICON)).click();
}

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

License:Apache License

/**
 * Counts the number of rows are in the table
 * @return/*from  w  ww .  j  a v a  2  s .c om*/
 */
public int numRows() {
    List<WebElement> rows = overlayUI.findElements(By.className("editRow"));
    return rows.size();
}

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

License:Apache License

/**
 * Gets the string that is displayed in the cell for the property key
 * @return//ww w  .j a  v a2  s  .c o m
 */
public String getPropDisp() {
    return rowUI.findElement(By.className(EDIT_KEY_CELL)).getText();
}

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

License:Apache License

/**
 * Gets the &lt;textarea&gt; element
 * @return
 */
public WebElement valueInput() {
    return rowUI.findElement(By.className(EDIT_VALUE_INPUT));
}