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

License:Open Source License

/**
 * Swipe page./*from  w ww.j a  v a2 s  .  c  o m*/
 * @param leftOrRight the left or right
 * @see com.ecofactor.qa.automation.newapp.page.MenuPage#swipePage(java.lang.String)
 */
@Override
public void swipePage(String leftOrRight) {

    WebElement thermostatContent = null;

    if (leftOrRight.equalsIgnoreCase(RIGHT)) {
        isDisplayed(getDriver(), By.cssSelector(MENU_HEADER), TINY_TIMEOUT);
        thermostatContent = getElement(getDriver(), By.cssSelector(MENU_HEADER), TINY_TIMEOUT);
        WaitUtil.oneSec();
        thermostatContent.click();
        // getAction().doSwipeRight(thermostatContent);

    } else {
        isDisplayed(getDriver(), By.className(MENU_PAGE_ICON), TINY_TIMEOUT);
        thermostatContent = getElement(getDriver(), By.className(MENU_PAGE_ICON), TINY_TIMEOUT);
        getAction().click(thermostatContent);
        getAction().rejectAlert();
    }
}

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

License:Open Source License

/**
 * Checks if is footer slice displayed.//from  w  ww  .  j a  v a 2s  . co m
 * @return true, if is footer slice displayed
 * @see com.ecofactor.qa.automation.newapp.page.MenuPage#isFooterSliceDisplayed()
 */
public boolean isFooterSliceDisplayed() {

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

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

License:Open Source License

/**
 * Click slice./*from w  ww  .j  a  v  a 2 s  .c om*/
 * @see com.ecofactor.qa.automation.newapp.page.MenuPage#clickFooterSlice()
 */
public void clickSlice() {

    setLogString("Click Slice Area", true, CustomLogLevel.LOW);
    final WebElement menu_container = getElement(getDriver(), By.className("menu_container"), TINY_TIMEOUT);
    final WebElement footerElement = menu_container.findElement(By.className("off_menu_blocker"));
    getAction().click(footerElement);
    getAction().rejectAlert();
}

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

License:Open Source License

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

    setLogString("Verify the savings Page is loaded", true, CustomLogLevel.LOW);
    return isDisplayed(getDriver(), By.cssSelector(SAVINGS_CONTAINER), TINY_TIMEOUT)
            && isDisplayed(getDriver(), By.className(SAVINGS_DOLLARS), TINY_TIMEOUT)
            && isDisplayed(getDriver(), By.cssSelector(MENU_SAVINGS), TINY_TIMEOUT);

}

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

License:Open Source License

/**
 * Gets the Total Savings./*from  ww  w . j  av a 2s. co  m*/
 * @return savings
 * @see com.ecofactor.qa.automation.newapp.page.SavingsPage#getTotalSavings()
 */
@Override
public String getTotalSavings() {

    setLogString("Get total Savings Amount", true, CustomLogLevel.HIGH);
    final String savingsValue = getElement(getDriver(), By.className(SAVINGS_DOLLARS), TINY_TIMEOUT).getText();
    setLogString("Total Savings :" + savingsValue, true, CustomLogLevel.LOW);
    return savingsValue;
}

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

License:Open Source License

/**
 * Gets the current month.//w w  w.  ja v  a 2s  .c om
 * @return the current month
 * @see com.ecofactor.qa.automation.newapp.page.SavingsPage#getCurrentMonth()
 */
@Override
public String getCurrentMonthAndYear() {

    setLogString("Get Month and year", true, CustomLogLevel.HIGH);
    final String currentMonth = getElement(getDriver(), By.className(SAVINGS_MONTH), TINY_TIMEOUT).getText();
    setLogString("Current Month and Year: " + currentMonth, true, CustomLogLevel.HIGH);
    return currentMonth.substring(currentMonth.indexOf("-") + 1, currentMonth.length()).trim();
}

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

License:Open Source License

/**
 * Click previous./*from w w  w .  j  a va 2s.  co m*/
 * @see com.ecofactor.qa.automation.newapp.page.SavingsPage#clickPrevious()
 */
@Override
public void clickPrevious() {

    setLogString("Click previous", true, CustomLogLevel.HIGH);
    final WebElement backwardIcon = getElement(getDriver(), By.className(BACKWARD_ICON), TINY_TIMEOUT);
    getAction().click(backwardIcon);
    getAction().rejectAlert();
}

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

License:Open Source License

/**
 * Click next./*w ww. j a  va2  s.c  o  m*/
 * @see com.ecofactor.qa.automation.newapp.page.SavingsPage#clickNext()
 */
@Override
public void clickNext() {

    setLogString("Click Next", true, CustomLogLevel.HIGH);
    final WebElement forwardIcon = getElement(getDriver(), By.className(FORWARD_ICON), TINY_TIMEOUT);
    getAction().click(forwardIcon);
    getAction().rejectAlert();
}

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

License:Open Source License

/**
 * Gets the savings value.//from  www.  ja  v a2  s  . c o m
 * @return the savings value
 * @see com.ecofactor.qa.automation.newapp.page.SavingsPage#getSavingsValue()
 */
@Override
public String getSavingsValue() {

    final String savingsValue = getElement(getDriver(), By.className(SAVINGS_DOLLAR_AMOUNT), TINY_TIMEOUT)
            .getText();
    setLogString("Savings Amount :" + savingsValue, true, CustomLogLevel.HIGH);
    return savingsValue;
}

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

License:Open Source License

/**
 * Gets the savings hours.// ww w.ja  v a2s .co  m
 * @return the savings hours
 * @see com.ecofactor.qa.automation.newapp.page.SavingsPage#getSavingsHours()
 */
@Override
public String getSavingsHours() {

    final String savingsHrs = getElement(getDriver(), By.className(SAVINGS_HOURS), TINY_TIMEOUT).getText();
    setLogString("Savings Hours:" + savingsHrs, true, CustomLogLevel.HIGH);
    return savingsHrs.substring(savingsHrs.indexOf("(") + 1, savingsHrs.indexOf("h"));
}