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

License:Open Source License

/**
 * Click thermostat./*from   ww  w  . ja  va 2s  .  c o m*/
 * @see com.ecofactor.qa.automation.newapp.page.AwaySettingsOpsPage#setCoolTemp(java.lang.String)
 */
@Override
public void clickThermostat() {

    LogUtil.setLogString("Switch to Thermostat Page", true);
    isDisplayed(getDriver(), By.cssSelector(MENU_THERMOSTAT), TINY_TIMEOUT);
    final WebElement menuThermostatElement = getElement(getDriver(), By.cssSelector(MENU_THERMOSTAT),
            TINY_TIMEOUT);
    getAction().click(menuThermostatElement);
}

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

License:Open Source License

/**
 * Click menu icon./*from www.j  a v a  2 s .c om*/
 * @see com.ecofactor.qa.automation.newapp.page.AwaySettingsOpsPage#clickMenuIcon()
 */
public void clickMenuIcon() {

    WaitUtil.tinyWait();
    LogUtil.setLogString("Click Menu in away settings", true);
    getAction().rejectAlert();
    final WebElement menuAwayElement = getElement(getDriver(), By.cssSelector(MENU_AWAY), TINY_TIMEOUT);
    WaitUtil.oneSec();
    menuAwayElement.click();
    // getAction().click(menuAwayElement);
    getAction().rejectAlert();
}

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

License:Open Source License

/**
 * Swipe page.//www . j a va 2 s  . c o  m
 * @param direction the direction
 * @see com.ecofactor.qa.automation.newapp.page.AwaySettingsOpsPage#swipePage(java.lang.String)
 */
@Override
public void swipePage(final String direction) {

    final WebElement settingsContent = getElement(getDriver(), By.cssSelector("div.settings_content"),
            TINY_TIMEOUT);

    LogUtil.setLogString("Swipe " + direction, true, CustomLogLevel.MEDIUM);

    if (direction.contains(LEFT)) {

        getAction().doSwipeLeft(settingsContent);
    } else {

        getAction().doSwipeRight(settingsContent);

    }
}

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

License:Open Source License

/**
 * click back button to reach settings page.
 * @see com.ecofactor.qa.automation.newapp.page.AwaySettingsOpsPage#clickBack()
 *///from   w  w w. ja va 2 s . com
@Override
public void clickBack() {

    LogUtil.setLogString("Click Back", true, CustomLogLevel.MEDIUM);
    final WebElement backElement = getElement(getDriver(), By.cssSelector(".back"), TINY_TIMEOUT);
    getAction().click(backElement);
    getAction().rejectAlert();

}

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

License:Open Source License

/**
 * Gets the picker element.//from   www  . j a v a 2 s .  c om
 * @param setAwayParam the set away param
 * @return element.
 * @see com.ecofactor.qa.automation.newapp.page.AwaySettingsUIPage#getPickerElement(com.ecofactor.qa.automation.newapp.enums.SetAwayParams)
 */
@Override
public WebElement getPickerElement(final SetAwayParams setAwayParam) {

    WaitUtil.tinyWait();
    final boolean setAwayPage = setAway.isSetAwayPageLoaded();

    // setAway.clickAwaySettings();
    if (setAwayPage == true) {

        setAway.clickAwaySettings();
    } /* else {
              
      thPageOps.clickSettingsMenu();
      menuPage.clickAwayHiglighted();
      setAway.clickAwaySettings();
      }*/

    final WebElement settingsElement = getElement(getDriver(), By.cssSelector(SETTINGS_CONTAINER),
            TINY_TIMEOUT);

    List<WebElement> selectContainer = getElementsBySubElement(getDriver(), settingsElement,
            By.cssSelector("span.select_container"), TINY_TIMEOUT);

    final WebElement setAwayParamElement = getElementBySubElement(getDriver(),
            selectContainer.get(setAwayParam.getValue()), By.tagName("option"), TINY_TIMEOUT);
    return setAwayParamElement;
}

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

License:Open Source License

/**
 * Checks if is sets the away param label displayed.
 * @param setAwayParam the set away param
 * @return true, if is sets the away param label displayed
 * @see com.ecofactor.qa.automation.newapp.page.AwaySettingsUIPage#isSetAwayParamLabelDisplayed(com.ecofactor.qa.automation.newapp.enums.SetAwayParams)
 *///  w  ww.j  av a 2  s  . c o m
public boolean isSetAwayParamLabelDisplayed(final SetAwayParams setAwayParam) {

    final WebElement setpointPicker = getElement(getDriver(), By.cssSelector("div.settings_content"),
            TINY_TIMEOUT);
    return getElementBySubElementText(getDriver(), setpointPicker, By.tagName("label"), setAwayParam.toString(),
            TINY_TIMEOUT).isDisplayed();

}

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

License:Open Source License

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

    LogUtil.setLogString("Verify the Away Settings Page is loaded", true, CustomLogLevel.MEDIUM);
    waitForPageLoaded(getDriver());
    final boolean isHeaderDisplayed = isDisplayed(getDriver(), By.cssSelector(AWAY_SETTINGS_HEADER),
            TINY_TIMEOUT);
    return isHeaderDisplayed;
}

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

License:Open Source License

/**
 * Checks if is away settings alert displayed.
 * @return true, if is away settings alert displayed
 * @see com.ecofactor.qa.automation.newapp.page.AwaySettingsUIPage#isAwaySettingsAlertDisplayed()
 *//*from  ww  w  .j  a va 2s . c  o m*/
@Override
public boolean isAwaySettingsAlertDisplayed() {

    final boolean isAlertDisplayed = isDisplayed(getDriver(), By.cssSelector(SETTINGS_ALERT_LABEL),
            TINY_TIMEOUT);
    return isAlertDisplayed;

}

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

License:Open Source License

/**
 * Gets the next button.//from   w ww. ja v a2 s .com
 * @return the next button
 */
private WebElement getNextButton() {

    return getElement(getDriver(), By.cssSelector("div.nextButton"), TINY_TIMEOUT);
}

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

License:Open Source License

/**
 * Gets the started button.// ww w .  j  a v  a  2 s  . c  om
 * @return the started button
 */
private WebElement getStartedButton() {

    return getElement(getDriver(), By.cssSelector("div.doneButton"), TINY_TIMEOUT);
}