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.insite.page.RoleManagementImpl.java

License:Open Source License

/**
 * Click find./*from www  .j av  a 2s.co  m*/
 * @see com.ecofactor.qa.automation.insite.page.RoleManagement#clickFind()
 */
@Override
public void clickFind() {

    DriverConfig.setLogString("Click Find", true);
    WebElement findbuttonElement = retrieveElementByAttributeValue(DriverConfig.getDriver(), TAG_INPUT,
            ATTR_VALUE, "find");
    findbuttonElement.click();
}

From source file:com.ecofactor.qa.automation.insite.page.RoleManagementImpl.java

License:Open Source License

/**
 * Click menu./*from   w w w  .  j  a v a  2s. com*/
 * @param menu the menu
 * @see com.ecofactor.qa.automation.insite.page.RoleManagement#clickMenu(java.lang.String)
 */
@Override
public void clickMenu(String menu) {

    DriverConfig.setLogString("Click Menu : " + menu, true);
    final List<WebElement> menus = DriverConfig.getDriver().findElements(By.xpath("//*[@id='menu']/li/a"));
    for (WebElement webElement : menus) {

        if (webElement.getText().equalsIgnoreCase(menu)) {
            webElement.click();
            break;
        }

    }
    tinyWait();
}

From source file:com.ecofactor.qa.automation.insite.page.RoleManagementImpl.java

License:Open Source License

/**
 * Click sub menu.//  www  .java 2s.c  o  m
 * @param subMenu the sub menu
 * @see com.ecofactor.qa.automation.insite.page.RoleManagement#clickSubMenu(java.lang.String)
 */
@Override
public void clickSubMenu(String subMenu) {

    DriverConfig.setLogString("Click SubMenu : " + subMenu, true);
    final List<WebElement> menus = DriverConfig.getDriver().findElements(By.xpath("//*[@id='submenu']/a"));
    for (WebElement webElement : menus) {

        if (webElement.getText().equalsIgnoreCase(subMenu)) {
            webElement.click();
            break;
        }

    }
    tinyWait();

}

From source file:com.ecofactor.qa.automation.insite.page.RoleManagementImpl.java

License:Open Source License

/**
 * @see com.ecofactor.qa.automation.insite.page.RoleManagement#clickSubscribe()
 *//*from w  w w .  java 2 s. c  o m*/
@Override
public void clickSubscribe() {

    DriverConfig.setLogString("Click Subscribe", true);
    WebElement subscribeBtn = DriverConfig.getDriver()
            .findElement(By.xpath(".//*[@id='algo-actions-layout-bottom']/input[1]"));
    subscribeBtn.click();
}

From source file:com.ecofactor.qa.automation.insite.page.RoleManagementImpl.java

License:Open Source License

/**
 * @see com.ecofactor.qa.automation.insite.page.RoleManagement#clickUnSubscribe()
 *///w  ww .  j a  v a  2 s  . c om
@Override
public void clickUnSubscribe() {

    DriverConfig.setLogString("Click UnSubscribe", true);
    WebElement unSubscribeBtn = DriverConfig.getDriver()
            .findElement(By.xpath(".//*[@id='algo-actions-layout-bottom']/input[2]"));
    unSubscribeBtn.click();
}

From source file:com.ecofactor.qa.automation.insite.page.SupportLookUpImpl.java

License:Open Source License

/**
 * Search account look up.// ww w  .  j  a va 2  s.c  o m
 * @param textBoxFieldName the text box field name
 * @param textBoxFieldValue the text box field value
 */
public void searchAccountLookUp(final String textBoxFieldName, final String textBoxFieldValue) {

    DriverConfig.setLogString(
            "Send value to required text box and Click on find Button, then verify the search results are populated successfully.",
            true);
    logger.info("check if search text box is displayed.");
    boolean emailTextDisplayed = isDisplayedById(DriverConfig.getDriver(), textBoxFieldName, MEDIUM_TIMEOUT);
    logger.info("provide value in search text.");
    DriverConfig.setLogString("Search " + textBoxFieldValue, true);
    DriverConfig.getDriver().findElement(By.id(textBoxFieldName)).sendKeys(textBoxFieldValue);
    DriverConfig.setLogString("select find button.", true);
    if (emailTextDisplayed) {
        WebElement findbuttonElement = retrieveElementByAttributeValue(DriverConfig.getDriver(), TAG_INPUT,
                ATTR_VALUE, supportConfig.get(FIND_BUTTON));
        findbuttonElement.click();
        DriverConfig.setLogString("Verify Search result", true);
        confirmSearchResultValue(textBoxFieldValue);
    }
}

From source file:com.ecofactor.qa.automation.insite.page.SupportLookUpImpl.java

License:Open Source License

/**
 * Verify installation hardware./*from w  w w.  java 2s. com*/
 * @param emailId the email id
 */
public void verifyInstallationHardware(final String emailId) {

    DriverConfig.setLogString("Click on the emailId as recieved - " + emailId, true);
    WebElement searchElement = retrieveElementByLinkText(DriverConfig.getDriver(), emailId, MEDIUM_TIMEOUT);
    searchElement.click();
    WaitUtil.waitUntil(200);
    logger.info("Verify installed hardware menu is displayed.");
    isDisplayedByLinkText(DriverConfig.getDriver(), supportConfig.get(INSTALLED_HARDWARE_MENU), MEDIUM_TIMEOUT);

    DriverConfig.setLogString("Click on Installed Hardware.", true);
    WebElement installedHardwareElement = retrieveElementByLinkText(DriverConfig.getDriver(),
            supportConfig.get(INSTALLED_HARDWARE_MENU), SHORT_TIMEOUT);
    installedHardwareElement.click();
    WaitUtil.waitUntil(MEDIUM_TIMEOUT);

    verifyAndLogThermostatDetails();
    DriverConfig.setLogString("Verify there is no exception.", true);
    Assert.assertTrue(!DriverConfig.getDriver().getPageSource().contains("exception"), "Found exception");
    closeAlert(DriverConfig.getDriver());
}

From source file:com.ecofactor.qa.automation.insite.page.SupportLookUpImpl.java

License:Open Source License

/**
 * Click searched result element.//from ww  w .  j  a v a  2  s  .c o m
 * @param searchResultValue the search result value
 */
public void clickSearchedResultElement(final String searchResultValue) {

    logger.info("find search result container.");
    List<WebElement> resultElements = DriverConfig.getDriver()
            .findElements(By.className(supportConfig.get(SEARCH_RESULT_CLASS)));
    DriverConfig.setLogString("find search result shows up proper result and click it.", true);
    for (WebElement webElement : resultElements) {
        boolean outcome = webElement.getText().contains(searchResultValue) ? true : false;

        if (outcome) {
            webElement.click();
            tinyWait();
            break;
        }

    }
}

From source file:com.ecofactor.qa.automation.insite.page.SupportLookUpImpl.java

License:Open Source License

/**
 * Click reset password.//from   w  ww  . ja  va 2 s.c o m
 * @see com.ecofactor.qa.automation.insite.page.SupportLookUp#clickResetPassword()
 */
public void clickResetPassword() {

    smallWait();
    DriverConfig.setLogString("click reset password.", true);
    WebElement resetPswdDiv = DriverConfig.getDriver()
            .findElement(By.id("supportPage-leftNavigation-resetPasswordLink"));
    logger.info("resetPswdDiv class: " + resetPswdDiv.getAttribute("class"));
    resetPswdDiv.click();
    smallWait();
    List<WebElement> okButton = DriverConfig.getDriver().findElements(By.tagName("button"));
    okButton.get(0).click();
    closeAlert(DriverConfig.getDriver());
}

From source file:com.ecofactor.qa.automation.insite.page.SupportLookUpImpl.java

License:Open Source License

/**
 * Disable load shapping./* w  ww.  ja va2s .  c om*/
 * @param email the email
 */
public void disableLoadShapping(String email) {

    searchByEmail(email);
    WaitUtil.waitUntil(SHORT_TIMEOUT);
    WebElement emailElement = retrieveElementByLinkText(DriverConfig.getDriver(), email, SHORT_TIMEOUT);
    emailElement.click();
    WaitUtil.waitUntil(SHORT_TIMEOUT);
    WebElement disableLSButton = retrieveElementByAttributeValue(DriverConfig.getDriver(), TAG_INPUT,
            ATTR_VALUE, "Exclude Location");
    disableLSButton.click();
    Alert alert = DriverConfig.getDriver().switchTo().alert();
    alert.accept();
    DriverConfig.getDriver().switchTo().defaultContent();
    WaitUtil.waitUntil(SHORT_TIMEOUT);
    retrieveElementByAttributeValue(DriverConfig.getDriver(), TAG_INPUT, ATTR_VALUE, "Include Location");
}