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

License:Open Source License

/**
 * verify whether set away page loaded from Settings page.
 * @return true, if set away page loaded from settings page.
 *//*from  ww w .  j  a va2 s . co m*/
@Override
public boolean isSetAwayPageLoaded() {

    final boolean element = isDisplayed(getDriver(), By.cssSelector(AWAY_SETTINGS), TINY_TIMEOUT);
    return element;
}

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

License:Open Source License

/**
 * Alert message.//from  www.  j  ava 2 s.  c o  m
 * @return true, if successful.
 * @see com.ecofactor.qa.automation.newapp.page.SetAwayPage#alertMessage()
 */
@Override
public boolean alertMessage() {

    setLogString("Verify with alert Message", true, CustomLogLevel.MEDIUM);
    final boolean alertValue = isDisplayed(getDriver(), By.cssSelector(".settings_alert_label"), TINY_TIMEOUT);
    if (alertValue) {

        final WebElement alertMessage = getElement(getDriver(), By.cssSelector(".settings_alert_label"),
                TINY_TIMEOUT);
        setLogString("Alert Message" + alertMessage.getText(), true, CustomLogLevel.MEDIUM);
    }
    return true;
}

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

License:Open Source License

/**
 * Checks if is page loaded./* w  ww  .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 settings page is loaded", true);
    return isDisplayed(getDriver(), By.cssSelector(INSTALLED_THERMOSTAT), TINY_TIMEOUT)
            || isDisplayed(getDriver(), By.cssSelector(PREFERENCES), TINY_TIMEOUT)
            || isDisplayed(getDriver(), By.cssSelector(LANGUAGE), TINY_TIMEOUT)
            || isDisplayed(getDriver(), By.cssSelector(EMAIL), TINY_TIMEOUT)
            || isDisplayed(getDriver(), By.cssSelector(PASSWORD), TINY_TIMEOUT)
            || isDisplayed(getDriver(), By.cssSelector(SUPPORT), TINY_TIMEOUT)
            || isDisplayed(getDriver(), By.cssSelector(LEGAL), TINY_TIMEOUT);
}

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

License:Open Source License

/**
 * Click menu settings./*  ww w.j av a  2  s. c o  m*/
 * @see com.ecofactor.qa.automation.newapp.page.SettingsPage#clickMenuSettings()
 */
@Override
public void clickMenuSettings() {

    setLogString("Click Accounts settings in Menu Page", true);
    final WebElement menuIcon = getElement(getDriver(), By.cssSelector(SETTINGS_ICON), TINY_TIMEOUT);
    menuIcon.click();
    getAction().rejectAlert();
}

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

License:Open Source License

/**
 * Click privacy policy tab./*from   ww  w  . java2s. c o  m*/
 * @see com.ecofactor.qa.automation.newapp.page.SettingsPage#clickPrivacyPolicyTab()
 */
@Override
public void clickPrivacyPolicyTab() {

    setLogString("Click Legal Privacy Policy Tab", true);
    final WebElement privacyElement = getElement(getDriver(), By.cssSelector(PRIVACY_POLICY), TINY_TIMEOUT);
    privacyElement.click();
    getAction().rejectAlert();
}

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

License:Open Source License

/**
 * Click user agreement tab./*from w  w w.  j a v  a  2 s.  c o m*/
 * @see com.ecofactor.qa.automation.newapp.page.SettingsPage#clickUserAgreementTab()
 */
@Override
public void clickUserAgreementTab() {

    setLogString("Click Legal User Agreement Tab", true);
    final WebElement userElement = getElement(getDriver(), By.cssSelector(USER_AGREEMENT), TINY_TIMEOUT);
    userElement.click();
    getAction().rejectAlert();
}

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

License:Open Source License

/**
 * Click menu highlighted./* w w w . j av  a2s .  c om*/
 * @see com.ecofactor.qa.automation.newapp.page.SettingsPage#clickMenuHighlighted()
 */
@Override
public void clickMenuHighlighted() {

    setLogString("Click Menu in Thermostat", true, CustomLogLevel.LOW);
    final WebElement menuBtn = getElement(getDriver(), By.cssSelector(MENU_BTN), TINY_TIMEOUT);
    WaitUtil.oneSec();
    getAction().click(menuBtn);
    getAction().rejectAlert();
}

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

License:Open Source License

/**
 * Change thermostat name.//w  ww. ja  v a2 s . c o m
 * @see com.ecofactor.qa.automation.newapp.page.SettingsPage#changeThermostatName()
 */
@Override
public void changeThermostatName() {

    setLogString("Click Thermostat name Field", true, CustomLogLevel.LOW);
    final WebElement thermostatField = getElement(getDriver(), By.cssSelector(THERMOSTAT_FIELD), TINY_TIMEOUT);
    getAction().click(thermostatField);
    WaitUtil.oneSec();
    getAction().rejectAlert();

    setLogString("Thermostat Field Name Changed.", true, CustomLogLevel.LOW);
    WaitUtil.oneSec();
    final WebElement fieldValue = getElement(getDriver(), By.cssSelector(THERMOSTAT_FIELD_VALUE), TINY_TIMEOUT);
    fieldValue.clear();
    WaitUtil.oneSec();
    fieldValue.sendKeys(THERMOSTAT_FIELD_NAME);
    WaitUtil.fourSec();

    setLogString("Updated Thermostat Field Name.", true, CustomLogLevel.LOW);
    final WebElement thermostatFieldName = getElement(getDriver(), By.cssSelector(INSTALLED_THERMOSTAT),
            TINY_TIMEOUT);
    getAction().click(thermostatFieldName);
    getAction().rejectAlert();

    tinyWait();
    clickMenuHighlighted();
}

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

License:Open Source License

/**
 * Change sixty char tst name.//from w w  w .j a  v  a  2 s  .com
 * @see com.ecofactor.qa.automation.newapp.page.SettingsPage#changeSixtyCharTstName()
 */
@Override
public void changeSixtyCharTstName() {

    setLogString("Click Thermostat name Field", true, CustomLogLevel.LOW);
    final WebElement thermostatField = getElement(getDriver(), By.cssSelector(THERMOSTAT_FIELD), TINY_TIMEOUT);
    getAction().click(thermostatField);
    WaitUtil.oneSec();
    getAction().rejectAlert();

    setLogString("Thermostat Field Name Changed.", true, CustomLogLevel.LOW);
    WaitUtil.oneSec();
    final WebElement fieldValue = getElement(getDriver(), By.cssSelector(THERMOSTAT_FIELD_VALUE), TINY_TIMEOUT);
    fieldValue.clear();
    WaitUtil.oneSec();
    fieldValue.sendKeys(TST_NAME_SIXTY_CHAR);
    WaitUtil.fourSec();

    setLogString("Updated Thermostat Field Name.", true, CustomLogLevel.LOW);
    getToastErrorMessage();
    final WebElement thermostatFieldName = getElement(getDriver(), By.cssSelector(INSTALLED_THERMOSTAT),
            TINY_TIMEOUT);
    getAction().click(thermostatFieldName);
    getAction().rejectAlert();

    tinyWait();
    clickMenuHighlighted();
}

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

License:Open Source License

/**
 * Verify language tab displayed.//from ww  w  .  j a va 2 s  . c o  m
 * @return true, if successful
 * @see com.ecofactor.qa.automation.newapp.page.SettingsPage#verifyLanguageTabDisplayed()
 */
@Override
public boolean verifyLanguageTabDisplayed() {

    setLogString("Verify Language Tab displayed", true, CustomLogLevel.LOW);
    return isDisplayed(getDriver(), By.cssSelector(LANGUAGE), TINY_TIMEOUT);
}