Example usage for org.openqa.selenium WebElement click

List of usage examples for org.openqa.selenium WebElement click

Introduction

In this page you can find the example usage for org.openqa.selenium WebElement click.

Prototype

void click();

Source Link

Document

Click this element.

Usage

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

License:Open Source License

/**
 * Click privacy policy tab./* w  w  w  .  j  ava  2s.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.//w  ww  . j  ava  2 s .c  om
 * @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 password tab./*from w ww .  j  a  v  a  2 s  . c o  m*/
 * @see com.ecofactor.qa.automation.newapp.page.SettingsPage#clickPasswordTab()
 */
@Override
public void clickPasswordTab() {

    setLogString("Click password tab", true, CustomLogLevel.LOW);
    final WebElement passwordTab = getElement(getDriver(), By.cssSelector(CHANGE_PASSWORD), TINY_TIMEOUT);
    WaitUtil.oneSec();
    passwordTab.click();
    getAction().rejectAlert();
}

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

License:Open Source License

/**
 * Click faq tab.//from w w w.j  a v  a 2s  . co  m
 * @see com.ecofactor.qa.automation.newapp.page.SettingsPage#clickFAQTab()
 */
@Override
public void clickFAQTab() {

    setLogString("Click FAQ tab", true, CustomLogLevel.LOW);
    final WebElement faqElement = getElement(getDriver(), By.cssSelector(FAQ_TAB), TINY_TIMEOUT);
    faqElement.click();
    getAction().rejectAlert();
}

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

License:Open Source License

/**
 * Click change password.//from  www  . j  a va 2  s  .c  om
 * @see com.ecofactor.qa.automation.newapp.page.SettingsPage#clickChangePassword()
 */
@Override
public void clickChangePasswordBtn() {

    setLogString("Click change apssword button", true, CustomLogLevel.LOW);
    final WebElement changeButton = getElement(getDriver(), By.cssSelector(BUTTON), TINY_TIMEOUT);
    changeButton.click();
}

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

License:Open Source License

/**
 * Gets the URL from phone browser./*w w w  . j  a v a2  s .c o m*/
 * @param element the element
 * @return the URL from phone browser
 */
private String getURLFromPhoneBrowser(final String element) {

    setLogString("Get URL from phone browser", true, CustomLogLevel.LOW);
    final boolean elementDisplayed = isDisplayed(getDriver(), By.cssSelector(element), TINY_TIMEOUT);
    String currentURL = "";
    WebDriverWait wait = new WebDriverWait(getDriver(), 10);
    final WebElement faqElement = getElement(getDriver(), By.cssSelector(element), TINY_TIMEOUT);
    if (elementDisplayed == true) {
        final String previousUrl = getDriver().getCurrentUrl();
        faqElement.click();
        getDriver().manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

        ExpectedCondition<Boolean> e = new ExpectedCondition<Boolean>() {
            public Boolean apply(WebDriver d) {

                return (d.getCurrentUrl() != previousUrl);
            }
        };
        wait.until(e);
        currentURL = getDriver().getCurrentUrl();

    }
    return currentURL;
}

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

License:Open Source License

/**
 * Click Savings Energy Efficient Link./*from   w ww  .  jav  a 2s  .c  o  m*/
 * @see com.ecofactor.qa.automation.newapp.page.ThermostatPageOps#clickSavingsEELink()
 */
@Override
public void clickSavingsEELink() {

    setLogString("Click Savings EE Link", true, CustomLogLevel.LOW);
    final WebElement savingsEELink = getElement(getDriver(), By.cssSelector(SAVINGS_ENERGY), THREE_SEC);
    savingsEELink.click();
    WaitUtil.oneSec();
    //getAction().rejectAlert();
}

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

License:Open Source License

/**
 * Sets the away popup closing./*from w w w  .  jav a2s.  co  m*/
 * @see com.ecofactor.qa.automation.newapp.page.ThermostatPage#setAway()
 */
@Override
public void setAway() {

    loadAwaySettingsPopup();

    final WebElement footerElement = getElement(getDriver(), By.cssSelector(".footerAwayPicker"),
            SHORT_TIMEOUT);
    final WebElement awaySettingsPopUp = getElementBySubElement(getDriver(), footerElement,
            By.cssSelector(".ctaButton.setAwaySubmitButton"), SHORT_TIMEOUT);
    awaySettingsPopUp.click();
    // getAction().click(awaySettingsPopUp);
    getAction().rejectAlert();
    if (awaySettingsPopUp != null) {
        // getAction().click(awaySettingsPopUp);
        awaySettingsPopUp.click();
        WaitUtil.oneSec();
        getAction().rejectAlert();
    }
}

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

License:Open Source License

/**
 * Click Menu./*ww  w  . j  a  va  2 s.  c  om*/
 * @see com.ecofactor.qa.automation.newapp.page.ThermostatPageOps#clickMenu()
 */
@Override
public void clickMenu() {

    setLogString("Click Menu", true, CustomLogLevel.LOW);
    final boolean isMenuDisplayed = isDisplayed(getDriver(), By.cssSelector(MENU), TINY_TIMEOUT);
    getAction().rejectAlert();
    if (isMenuDisplayed) {
        final WebElement menuElement = getElement(getDriver(), By.cssSelector(MENU), SHORT_TIMEOUT);
        menuElement.click();
        // getAction().click(menuElement);
        tinyWait();
        getAction().rejectAlert();
    }
    setLogString("Menu Page is Displayed", true, CustomLogLevel.LOW);
}