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.ecofactor.qa.automation.newapp.page.impl.SetAwayPageImpl.java

License:Open Source License

/**
 * Gets the away settings.//www. ja  v  a 2 s .c  o  m
 * @return the away settings
 */
@Override
public String[] getActualAwaySettings() {

    final WebElement awayInfoText = getElementBySubElement(getDriver(), getCurrentThermostatContainer(),
            By.className(TSTAT_POPUP_LABEL), TINY_TIMEOUT);
    final String[] awayInfo = awayInfoText.getText().split(" ");

    return awayInfo;
}

From source file:com.ecofactor.qa.automation.newapp.page.impl.SettingsPageImpl.java

License:Open Source License

/**
 * @return//from  www  .  j ava  2s  . c  o m
 * @see com.ecofactor.qa.automation.newapp.page.SettingsPage#isBackBtnDisplayed()
 */
@Override
public boolean isBackBtnDisplayed() {

    return isDisplayed(getDriver(), By.className("back"), TINY_TIMEOUT);
}

From source file:com.ecofactor.qa.automation.newapp.page.impl.SettingsPageImpl.java

License:Open Source License

/**
 * Fill current password.//from   w  w  w .j a v  a2 s. c o m
 * @param currentPasswd the current passwd
 */
private void fillCurrentPassword(String currentPasswd) {

    setLogString("Current Password  : " + currentPasswd, true, CustomLogLevel.LOW);
    if (currentPasswd != null && !currentPasswd.isEmpty()) {
        clearAndInput(getDriver(), By.className(CURRENT_PASSWD_FILED), currentPasswd);
    }

}

From source file:com.ecofactor.qa.automation.newapp.page.impl.SettingsPageImpl.java

License:Open Source License

/**
 * Fill new password.//from w ww  .  jav a  2 s  . c  o  m
 * @param newPasswd the new passwd
 */
private void fillNewPassword(String newPasswd) {

    setLogString("New Password  : " + newPasswd, true, CustomLogLevel.LOW);
    if (newPasswd != null && !newPasswd.isEmpty()) {
        clearAndInput(getDriver(), By.className(NEW_PASSWD_FILED), newPasswd);
    }

}

From source file:com.ecofactor.qa.automation.newapp.page.impl.SettingsPageImpl.java

License:Open Source License

/**
 * Fill repeat password./*from www  .  j a v a  2 s . c o  m*/
 * @param repeatPasswd the repeat passwd
 */
private void fillRepeatPassword(String repeatPasswd) {

    setLogString("Repeat Password  : " + repeatPasswd, true, CustomLogLevel.LOW);
    if (repeatPasswd != null && !repeatPasswd.isEmpty()) {
        clearAndInput(getDriver(), By.className(REPEAT_PASSWD_FILED), repeatPasswd);
    }

}

From source file:com.ecofactor.qa.automation.newapp.page.impl.ThermostatEEOpsPageImpl.java

License:Open Source License

/**
 * Click close.//from ww  w . java  2s .c om
 * @see com.ecofactor.qa.automation.newapp.page.ThermostatEEOpsPage#clickClose()
 */
@Override
public void clickClose() {

    setLogString("Click Close button in EE", true);
    WebElement closeBtnElement = getElement(getDriver(), By.className(CLOSE_BTN), TINY_TIMEOUT);
    if (closeBtnElement != null && closeBtnElement.isDisplayed()) {
        getAction().click(closeBtnElement);
    }

}

From source file:com.ecofactor.qa.automation.newapp.page.impl.ThermostatEEUIPageImpl.java

License:Open Source License

/**
 * Checks if is close button displayed./*from www  .j a  v a  2 s  .  c om*/
 * @return true, if is close button displayed
 * @see com.ecofactor.qa.automation.newapp.page.ThermostatEEUIPage#isCloseButtonDisplayed()
 */
@Override
public boolean isCloseButtonDisplayed() {

    setLogString("is Close Button Displayed in EE ?", true);
    WebElement closeBtnElement = getElement(getDriver(), By.className(CLOSE_BTN), TINY_TIMEOUT);
    if (closeBtnElement != null && closeBtnElement.isDisplayed()) {
        setLogString("Close Button is displayed", true);
        return true;
    }
    return false;
}

From source file:com.ecofactor.qa.automation.newapp.page.impl.ThermostatEEUIPageImpl.java

License:Open Source License

/**
 * Checks if is content displayed./*  w  w  w  .  j  a v  a2 s.  c o m*/
 * @return true, if is content displayed
 * @see com.ecofactor.qa.automation.newapp.page.ThermostatEEUIPage#isContentDisplayed()
 */
@Override
public boolean isContentDisplayed() {

    setLogString("is EE Description Content present?", true);
    WebElement contentElement = getElement(getDriver(), By.className(TEXT_CONTAINER), TINY_TIMEOUT);
    if (contentElement != null) {

        WebElement paragraph = getElementBySubElement(getDriver(), contentElement, By.tagName("p"),
                TINY_TIMEOUT);
        if (paragraph != null && paragraph.getText() != null && paragraph.getText().length() > 0) {
            setLogString("EE Description is displayed", true);
            setLogString("EE Description is:\n" + contentElement.getText(), true, CustomLogLevel.HIGH);
            return true;
        }
    }
    return false;
}

From source file:com.ecofactor.qa.automation.newapp.page.impl.ThermostatPageOpsImpl.java

License:Open Source License

/**
 * Close help./*from  w  w  w .j a  va  2 s  . c o  m*/
 * @see com.ecofactor.qa.automation.newapp.page.ThermostatPage#closeHelp()
 */
@Override
public void closeHelp() {

    setLogString("Verify and close help page", true, CustomLogLevel.HIGH);
    final boolean isHelpDisplayed = isDisplayed(getDriver(), By.className(HELP_DIV), THREE_SEC);
    if (isHelpDisplayed || !helpNotDisplayed()) {
        clickNextAndCloseHelp();
    }
}

From source file:com.ecofactor.qa.automation.newapp.page.impl.ThermostatPageOpsImpl.java

License:Open Source License

/**
 * Click current temp./*from www.  j a v a2s .c om*/
 * @see com.ecofactor.qa.automation.mobile.page.ThermostatPage#clickCurrentTemp()
 */
@Override
public void clickCurrentTemp() {

    setLogString("Click CurrentTemperature", true, CustomLogLevel.LOW);
    isDisplayedBySubElement(getDriver(), getCurrentThermostatContainer(), By.cssSelector(CURRENT_TEMPERATURE),
            ATOMIC_TIMEOUT);
    final WebElement currentTemperature = getElementBySubElement(getDriver(), getCurrentThermostatContainer(),
            By.className(CURRENT_TEMPERATURE), ATOMIC_TIMEOUT);

    final boolean isClickable = isClickable(getDriver(), currentTemperature, TINY_TIMEOUT);
    if (isClickable) {
        setLogString("Clicked CurrentTemperature", true, CustomLogLevel.LOW);
        try {
            getAction().click(currentTemperature);
            getAction().rejectAlert();
        } catch (WebDriverException wde) {
            setLogString("Cannot Click CurrentTemperature", true, CustomLogLevel.LOW);
        }
    } else {
        setLogString("Cannot Click Current Temperature", true, CustomLogLevel.LOW);
    }

}