Example usage for org.openqa.selenium By cssSelector

List of usage examples for org.openqa.selenium By cssSelector

Introduction

In this page you can find the example usage for org.openqa.selenium By cssSelector.

Prototype

public static By cssSelector(String cssSelector) 

Source Link

Document

Find elements via the driver's underlying W3C Selector engine.

Usage

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

License:Open Source License

/**
 * close the savings icon./*w  w w  .j a  v  a 2s. c  o m*/
 * @see com.ecofactor.qa.automation.newapp.page.ThermostatPageOps#isSavingsClickable()
 */
@Override
public void isSavingsClickable() {

    setLogString("Check either savings icon clickable", true, CustomLogLevel.LOW);
    final WebElement savingsElement = getElement(getDriver(), By.cssSelector(SAVINGS_ENERGY), TINY_TIMEOUT);
    isClickable(getDriver(), savingsElement, MEDIUM_TIMEOUT);
}

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

License:Open Source License

/**
 * close set Away icon ./* w  ww  .  j  ava  2 s  .  c  om*/
 * @see com.ecofactor.qa.automation.newapp.page.ThermostatPageOps#closeSetAwayIcon()
 */
@Override
public void closeSetAwayIcon() {

    setLogString("close setAway Icon", true, CustomLogLevel.LOW);
    final WebElement setAwayIcon = getElement(getDriver(), By.cssSelector(".ctaButton.setAwayCancelButton"),
            MEDIUM_TIMEOUT);
    WaitUtil.oneSec();
    setAwayIcon.click();
    WaitUtil.tinyWait();
    getAction().rejectAlert();
}

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

License:Open Source License

/**
 * Checks if is heater on./*from   w  w w . j  a  v a2 s. c  om*/
 * @return true, if is heater on
 */
public boolean isHeaterOn() {

    setLogString("Is Heater ON", true, CustomLogLevel.HIGH);
    final WebElement leftLine = getElement(getDriver(), By.cssSelector(LEFT_TEMP_BOTTOM_POSITION),
            SHORT_TIMEOUT);
    final WebElement rightLine = getElement(getDriver(), By.cssSelector(RIGHT_TEMP_TOP_POSITION),
            SHORT_TIMEOUT);
    return leftLine != null && rightLine != null;
}

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

License:Open Source License

/**
 * Checks if is ac on.//ww  w. j av  a 2s .c  om
 * @return true, if is ac on
 */
public boolean isAcOn() {

    setLogString("Is Cooler ON", true, CustomLogLevel.HIGH);
    final WebElement leftLine = getElement(getDriver(), By.cssSelector(LEFT_TEMP_TOP_POSITION), SHORT_TIMEOUT);
    final WebElement rightLine = getElement(getDriver(), By.cssSelector(RIGHT_TEMP_BOTTOM_POSITION),
            SHORT_TIMEOUT);
    return leftLine != null && rightLine != null;
}

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

License:Open Source License

/**
 * Checks if is mode off./*w w w  . j  a v  a2 s.  c o m*/
 * @return true, if is mode off
 * @see com.ecofactor.qa.automation.mobile.page.ThermostatPage#isModeOff()
 */
@Override
public boolean isModeOff() {

    setLogString("Verify the mode is off.", true, CustomLogLevel.MEDIUM);
    final WebElement currentMode = getElementBySubElement(getDriver(), getCurrentThermostatContainer(),
            By.cssSelector(OFF_MODE_BACK), TINY_TIMEOUT);
    return (currentMode != null && currentMode.isDisplayed()) ? true : false;
}

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

License:Open Source License

/**
 * Gets the no of locations.//from w  ww  .j a v a2 s.  c o m
 * @return the no of locations
 * @see com.ecofactor.qa.automation.mobile.page.ThermostatPage#getNoOfLocations()
 */
@Override
public Integer getNoOfLocations() {

    isDisplayed(getDriver(), By.cssSelector(LOCATION_CONTAINER), TINY_TIMEOUT);
    final List<WebElement> locationContainer = getElements(getDriver(), By.cssSelector(LOCATION_CONTAINER_NAME),
            TINY_TIMEOUT);
    return locationContainer.size();
}

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

License:Open Source License

/**
 * Checks if is savings displayed.//from w  ww  .j a va  2 s  . c o m
 * @return true, if is savings displayed
 * @see com.ecofactor.qa.automation.mobile.page.ThermostatPage#isSavingsDisplayed()
 */
public boolean isSavingsDisplayed() {

    setLogString("Check Savings Icon is displayed", true, CustomLogLevel.MEDIUM);
    return isDisplayed(getDriver(), By.cssSelector(SAVINGS), TINY_TIMEOUT);
}

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

License:Open Source License

/**
 * Checks if is target temp displayed.//from  ww  w.jav  a  2 s.  co m
 * @return true, if is target temp displayed
 * @see com.ecofactor.qa.automation.mobile.page.ThermostatPage#isTargetTempDisplayed()
 */
@Override
public boolean isTargetTempDisplayed() {

    setLogString("Check target temperature is displayed.", true, CustomLogLevel.MEDIUM);
    final boolean isTargetTempDisplayed = isDisplayedBySubElement(getDriver(), getCurrentThermostatContainer(),
            By.cssSelector(SETPOINT), TINY_TIMEOUT);
    setLogString("Target temperature displayed : " + isTargetTempDisplayed, true, CustomLogLevel.MEDIUM);
    return isTargetTempDisplayed;
}

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

License:Open Source License

/**
 * Checks if is current temp displayed.//from   w  ww  .  j a v a  2  s  . co m
 * @return true, if is current temp displayed
 * @see com.ecofactor.qa.automation.newapp.page.ThermostatPageUI#isCurrentTempDisplayed()
 */
@Override
public boolean isCurrentTempDisplayed() {

    setLogString("Check current temperature is displayed.", true, CustomLogLevel.MEDIUM);
    final boolean isTargetTempDisplayed = isDisplayedBySubElement(getDriver(), getCurrentThermostatContainer(),
            By.cssSelector("div.currentTemperature"), TINY_TIMEOUT);
    return isTargetTempDisplayed;
}