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

License:Open Source License

/**
 * Gets the savings percentage.//from  ww w .j  a va 2 s  . c  o  m
 * @return the savings percentage
 * @see com.ecofactor.qa.automation.newapp.page.SavingsPage#getSavingsPercentage()
 */
@Override
public String getSavingsPercentage() {

    final String savingsPercent = getElement(getDriver(), By.className(SAVINGS_PERCENTAGE), TINY_TIMEOUT)
            .getText();
    setLogString("Savings Percentage:" + savingsPercent + "%", true, CustomLogLevel.HIGH);
    return savingsPercent + "%";
}

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

License:Open Source License

/**
 * Checks if is footer displayed.// ww  w . j  a v  a2 s  .  c o m
 * @return true, if is footer displayed
 */
@Override
public boolean isFooterDisplayed() {

    setLogString("Check footer is not displayed", true, CustomLogLevel.HIGH);
    return isNotDisplayed(getDriver(), By.className(FOOTER_CONTAINER), TINY_TIMEOUT);
}

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

License:Open Source License

/**
 * Checks if is arrow displayed./*from   www.j  a  v a2 s. co m*/
 * @param arrow the arrow
 * @return true, if is arrow displayed
 * @see com.ecofactor.qa.automation.newapp.page.SavingsPage#isArrowDisplayed(java.lang.String)
 */
@Override
public boolean isArrowDisplayed(String arrow) {

    setLogString("Check " + arrow + " Arrow is displayed", true, CustomLogLevel.HIGH);
    if (arrow.equalsIgnoreCase("Left")) {
        return isDisplayed(getDriver(), By.className(BACKWARD_ICON), TINY_TIMEOUT);
    } else if (arrow.equalsIgnoreCase("Right")) {
        return isDisplayed(getDriver(), By.className(FORWARD_ICON), TINY_TIMEOUT);
    }
    return false;
}

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

License:Open Source License

/**
 * Gets the location name.//from   w  ww.  j a v  a  2  s.com
 * @return the location name
 * @see com.ecofactor.qa.automation.newapp.page.SavingsPage#getLocationName()
 */
@Override
public String getLocationName() {

    final String locationName = getElement(getDriver(), By.className(SAVINGS_LOCATION), TINY_TIMEOUT).getText();
    setLogString("Savings Location Name :" + locationName, true);
    return locationName;
}

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

License:Open Source License

/**
 * Gets the tstat status message.//from   ww w  . j  av  a2s . c  o  m
 * @return the tstat status message
 */
private String getTstatStatusMessage() {

    String thStatusMsg = null;
    WebElement modeDialog = getElement(getDriver(), By.cssSelector(MODEL_DIALOG), TINY_TIMEOUT);
    if (modeDialog.isDisplayed()) {
        WebElement modeMessage = getElementBySubElement(getDriver(), modeDialog, By.className(ERROR_MODEBOX),
                TINY_TIMEOUT);
        thStatusMsg = getElementBySubElement(getDriver(), modeMessage, By.className(MODEL_LABEL), TINY_TIMEOUT)
                .getText();
        setLogString("Location status message:" + thStatusMsg, true, CustomLogLevel.HIGH);
    }
    return thStatusMsg;
}

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

License:Open Source License

/**
 * @return/*ww w  .  ja va2 s  .c o  m*/
 * @see com.ecofactor.qa.automation.newapp.page.SavingsPage#isSavingsDollarVertical()
 */
@Override
public boolean isSavingsDollarVertical() {

    final WebElement savingsDollarElement = getElement(getDriver(),
            By.className("fusioncharts-yaxis-0-gridlabels"), TINY_TIMEOUT);
    final List<WebElement> savingsDollar = getElementsBySubElement(getDriver(), savingsDollarElement,
            By.tagName("text"), TINY_TIMEOUT);
    boolean isVertical = false;
    for (WebElement webElement : savingsDollar) {
        setLogString("SavingsDollar :"
                + getElementBySubElement(getDriver(), webElement, By.tagName("tspan"), TINY_TIMEOUT).getText(),
                true, CustomLogLevel.HIGH);
        isVertical = Integer.valueOf(webElement.getLocation().getX())
                .equals(Integer.valueOf(savingsDollar.get(1).getLocation().getX()));
        if (!isVertical) {
            break;
        }
    }
    setLogString("SavingsDollar isVertical :" + isVertical, true, CustomLogLevel.LOW);
    return isVertical;
}

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

License:Open Source License

/**
 * @return/* www.  j av  a 2s  .co m*/
 * @see com.ecofactor.qa.automation.newapp.page.SavingsPage#isSavingsMonthHorizontal()
 */
@Override
public boolean isSavingsMonthHorizontal() {

    final WebElement savingsMonthElement = getElement(getDriver(),
            By.className("fusioncharts-xaxis-0-gridlabels"), TINY_TIMEOUT);
    final List<WebElement> savingsMonth = getElementsBySubElement(getDriver(), savingsMonthElement,
            By.tagName("text"), TINY_TIMEOUT);
    boolean isHorizontal = false;
    for (WebElement webElement : savingsMonth) {
        setLogString("SavingsMonth :"
                + getElementBySubElement(getDriver(), webElement, By.tagName("tspan"), TINY_TIMEOUT).getText(),
                true, CustomLogLevel.HIGH);
        isHorizontal = Integer.valueOf(webElement.getLocation().getY())
                .equals(Integer.valueOf(savingsMonth.get(1).getLocation().getY()));
        if (!isHorizontal) {
            break;
        }
    }
    setLogString("SavingsMonth isHorizontal :" + isHorizontal, true, CustomLogLevel.LOW);
    return isHorizontal;
}

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

License:Open Source License

/**
 * Checks if is sets the point picker displayed.
 * @return true, if is sets the point picker displayed
 *//*from ww  w  .j  a  v  a 2s  .  co m*/
public boolean isSetPointPickerDisplayed() {

    return isDisplayed(getDriver(), By.className("awaySetpointPicker"), ATOMIC_TIMEOUT);
}

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

License:Open Source License

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

    setLogString("Verify if Away Page is loaded.", true, CustomLogLevel.MEDIUM);
    return isDisplayedBySubElement(getDriver(), getCurrentThermostatContainer(), By.className(TSTAT_POPUP),
            ATOMIC_TIMEOUT);
}

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

License:Open Source License

/**
 * Click am back./*  www. j a va  2s.  c o  m*/
 * @see com.ecofactor.qa.automation.newapp.page.SetAwayPage#clickAmBack()
 */
@Override
public void clickAmBack() {

    setLogString("Click I'm back button.", true, CustomLogLevel.LOW);
    final WebElement iAmBackBtnElement = getElementBySubElement(getDriver(), getCurrentThermostatContainer(),
            By.className(TSTAT_POPUP_BTN), ATOMIC_TIMEOUT);
    getAction().click(iAmBackBtnElement);
    getAction().rejectAlert();
}