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.ThermostatPageOpsImpl.java

License:Open Source License

/**
 * Turn system on.//from  ww w  .j a  v  a 2s .  c  o m
 * @see com.ecofactor.qa.automation.mobile.page.ThermostatPage#turnSystemOn()
 */
@Override
public void turnSystemOn() {

    setLogString("Turn System ON", true, CustomLogLevel.LOW);
    isDisplayedBySubElement(getDriver(), getCurrentThermostatContainer(), By.className(OFF_MODE_BACK),
            TINY_TIMEOUT);
    final WebElement turnSystemON = getElementBySubElement(getDriver(), getCurrentThermostatContainer(),
            By.className(OFF_MODE_BACK), TINY_TIMEOUT);
    getAction().click(turnSystemON);
    getAction().rejectAlert();
    Assert.assertFalse(isDisplayedBySubElement(getDriver(), getCurrentThermostatContainer(),
            By.className(OFF_MODE_BACK), TINY_TIMEOUT), "Fails to Turn ON System in UI");
}

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

License:Open Source License

/**
 * Help not displayed./*from   www  . j a  v a 2 s. c  o m*/
 * @return true, if successful
 */
private boolean helpNotDisplayed() {

    final boolean isHelpNotDisplayed = isNotDisplayed(getDriver(), By.className(HELP_DIV), TINY_TIMEOUT);
    return isHelpNotDisplayed;
}

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

License:Open Source License

/**
 * Click close help./*w  ww  .  j av  a2  s.co m*/
 */
@SuppressWarnings("unused")
private void clickCloseHelp() {

    setLogString("Close Help", true, CustomLogLevel.LOW);
    final WebElement closeBack = getElement(getDriver(), By.className(HELP_DIV), TINY_TIMEOUT);
    final WebElement closeElement = getElementBySubElement(getDriver(), closeBack, By.className(HELP_CLOSE),
            TINY_TIMEOUT);
    getAction().click(closeElement);
}

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

License:Open Source License

/**
 * Click next and close help.//  w w w .j  a v a 2s .  c  om
 */
private void clickNextAndCloseHelp() {

    setLogString(Marker.START, "Click Next and close the help Page", true);
    final WebElement next = getElement(getDriver(), By.className("nextButton"), TINY_TIMEOUT);
    if (next != null) {
        getAction().click(next);
        smallWait();
    }
    final WebElement next2 = getElement(getDriver(), By.className("nextButton"), TINY_TIMEOUT);
    if (next2 != null) {
        getAction().click(next2);
        smallWait();
    }
    final WebElement doneButton = getElement(getDriver(), By.className("doneButton"), TINY_TIMEOUT);
    if (doneButton != null) {
        getAction().click(doneButton);
        smallWait();
    }

    setLogString(Marker.END, "Closed Help", true);

}

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

License:Open Source License

/**
 * Click location switcher.//from  w w w.  j  a  v a  2s  . c  o m
 * @see com.ecofactor.qa.automation.newapp.page.ThermostatPageOps#clickLocationSwitcher()
 */
@Override
public void clickLocationSwitcher() {

    setLogString("Click Location Switcher Icon", true, CustomLogLevel.HIGH);
    final WebElement tsatSwitcherElement = getElement(getDriver(), By.className(THERMOSTAT_SWITCHER_ICON),
            TINY_TIMEOUT);
    getAction().click(tsatSwitcherElement);
    getAction().rejectAlert();
}

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

License:Open Source License

/**
 * Checks if is page loaded.// w  w w.  j  a  v  a  2  s . co m
 * @return true, if is page loaded
 * @see com.ecofactor.qa.automation.mobile.page.BasePage#isPageLoaded()
 */
@Override
public boolean isPageLoaded() {

    getAction().rejectAlert();
    getAction().clickTryAgain();
    setLogString("Verify Thermostat Page Loaded.", true, CustomLogLevel.LOW);
    isDisplayed(getDriver(), By.className(UNUSED_BTM_CONTAINER), TINY_TIMEOUT);
    isDisplayed(getDriver(), By.className(UNUSED_TOP_CONTAINER), TINY_TIMEOUT);
    loginPage.setLoggedIn(true);
    setPageLoadTimeOnLogin(new LocalTime());
    return isDisplayed(getDriver(), By.className(TH_AXIS_CONTAINER), TINY_TIMEOUT)
            && isDisplayed(getDriver(), By.className(LOCATION_NAME), TINY_TIMEOUT)
            && isDisplayed(getDriver(), By.className(MENU), TINY_TIMEOUT);
}

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

License:Open Source License

/**
 * Checks if is home icon displayed.//from  w  w w.  ja v a2s . com
 * @return true, if is home icon displayed
 * @see com.ecofactor.qa.automation.mobile.page.ThermostatPage#isHomeIconDisplayed()
 */
@Override
public boolean isHomeIconDisplayed() {

    setLogString("Check Home Icon is displayed", true, CustomLogLevel.MEDIUM);
    return isDisplayed(getDriver(), By.className(HOME_ICON), TINY_TIMEOUT);
}

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

License:Open Source License

/**
 * Checks if is logout icon displayed./*from  w  w w  .  java  2 s .  c  om*/
 * @return true, if is logout icon displayed
 * @see com.ecofactor.qa.automation.mobile.page.ThermostatPage#isLogoutIconDisplayed()
 */
@Override
public boolean isMenuIconDisplayed() {

    setLogString("Check Menu icon is displayed", true, CustomLogLevel.MEDIUM);
    return isDisplayed(getDriver(), By.className(MENU), TINY_TIMEOUT);
}

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

License:Open Source License

/**
 * Checks if is learn more clickable.// w  w  w .  j  a  v a 2 s.  c o  m
 * @return true, if is learn more clickable
 * @see com.ecofactor.qa.automation.newapp.page.ThermostatPageUI#isLearnMoreClickable()
 */
@Override
public boolean isLearnMoreClickable() {

    setLogString("Is Leran More button clickable", true, CustomLogLevel.HIGH);
    final WebElement errorModeInfoLink = getElement(getDriver(), By.className(ERROR_MODE_INFO), SHORT_TIMEOUT);
    return isClickable(getDriver(), errorModeInfoLink, TINY_TIMEOUT);
}

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

License:Open Source License

/**
 * Gets the current location name.// w w  w.  j av a2 s  . c o m
 * @return the current location name
 * @see com.ecofactor.qa.automation.mobile.page.ThermostatPage#getCurrentLocationName()
 */
@Override
public String getCurrentLocationName() {

    String name = "";
    final List<WebElement> themostatNameList = getElements(getDriver(), By.cssSelector(TSTAT_HEADER),
            TINY_TIMEOUT);
    for (final WebElement webElement : themostatNameList) {
        if (webElement.isDisplayed()) {
            final WebElement themostatName = getElementBySubElement(getDriver(),
                    getCurrentThermostatContainer(), By.className(LOCATION_NAME), TINY_TIMEOUT);
            final String locationName = themostatName.getText();
            if (locationName.contains("-")) {
                final int tstaNameIndex = locationName.lastIndexOf("-");
                name = locationName.substring(tstaNameIndex + 1, locationName.length());
                setLogString("Current Location Name : " + name, true, CustomLogLevel.HIGH);
            }
            break;
        }
    }
    return name;
}