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

License:Open Source License

/**
 * Close popup.//from www .ja  va2  s.c om
 */
public void closePopup() {

    DriverConfig.setLogString("Close popup", true);
    List<WebElement> listElement = retrieveElementsByAttributeValueList(DriverConfig.getDriver(), TAG_SPAN,
            ATTR_CLASS, supportConfig.get(OK_BTN));
    for (WebElement element : listElement) {
        if (element.getText().equalsIgnoreCase("Close")) {
            element.click();
        }
    }
    smallWait();
}

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

License:Open Source License

/**
 * search by emial address./*from  www. ja va  2 s.  c o m*/
 * @param address the address
 */
public void searchByAddress(String address) {

    DriverConfig.setLogString("Enter address as " + address, true);
    WebElement addressElement = DriverConfig.getDriver().findElement(By.id("address"));
    addressElement.sendKeys(address);
    tinyWait();

    WebElement buttonElement = retrieveElementByContainsOfAttributeValue(DriverConfig.getDriver(), TAG_INPUT,
            ATTR_VALUE, "Find", MEDIUM_TIMEOUT);
    buttonElement.click();
}

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

License:Open Source License

/**
 * Click installation date picker.//from  w  w w .  j ava  2 s.c o  m
 */
public void clickInstallationDate() {

    DriverConfig.setLogString("Click Installation Date/Time", true);
    WebElement dateElement = DriverConfig.getDriver().findElement(By.id("datetime"));
    dateElement.click();
}

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

License:Open Source License

/**
 * Search in support.//from  ww  w . j a va2s.  c o  m
 * @param textBoxFieldName the text box field name
 * @param textBoxFieldValue the text box field value
 */
private void searchInSupport(final String textBoxFieldName, final String textBoxFieldValue) {

    DriverConfig.setLogString("Send value to required text box and Click on find Button", 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();
    }
}

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

License:Open Source License

/**
 * Click reset password./* ww w.  j a  v  a2s.c o m*/
 * @see com.ecofactor.qa.automation.insite.page.UserManagement#clickResetPassword()
 */
public void clickResetPassword() {

    smallWait();
    DriverConfig.setLogString("Click Reset Password.", true);
    final WebElement resetPswdLink = retrieveElementByTagText(DriverConfig.getDriver(), TAG_ANCHOR, "Reset");
    resetPswdLink.click();
    closeAlert(DriverConfig.getDriver());
    closeAlert(DriverConfig.getDriver());
}

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

License:Open Source License

/**
 * Click edit.//from w w  w  .ja  va  2 s. co  m
 * @see com.ecofactor.qa.automation.insite.page.UserManagement#clickEdit()
 */
public void clickEdit() {

    DriverConfig.setLogString("Click edit user link.", true);
    final WebElement editLink = retrieveElementByTagText(DriverConfig.getDriver(), TAG_ANCHOR, "Edit User");
    editLink.click();
    tinyWait();
}

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

License:Open Source License

/**
 * Click save.//from   w ww  .ja  v a 2 s.com
 * @see com.ecofactor.qa.automation.insite.page.UserManagement#clickSave()
 */
public void clickSave() {

    DriverConfig.setLogString("Click save link.", true);
    final WebElement saveLink = retrieveElementByTagText(DriverConfig.getDriver(), TAG_ANCHOR, "Save");
    saveLink.click();
    tinyWait();
    DriverConfig.getDriver().switchTo().alert().getText()
            .equalsIgnoreCase("User succesfully created / updated");
    DriverConfig.setLogString("User Saved :" + DriverConfig.getDriver().switchTo().alert().getText(), true);
    DriverConfig.getDriver().switchTo().alert().accept();
}

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

License:Open Source License

/**
 * Search by name.// w w w .  j a v  a 2 s. c  o  m
 * @param name the name
 * @see com.ecofactor.qa.automation.insite.page.UserManagement#searchByName(java.lang.String)
 */
public void searchByName(final String name) {

    DriverConfig.setLogString("Search user by name.", true);
    final WebElement textBoxElement = DriverConfig.getDriver().findElement(By.id("fusername"));
    textBoxElement.sendKeys(name);
    DriverConfig.setLogString("Enter username in search text box: " + name, true);

    final WebElement buttonElement = retrieveElementByContainsOfAttributeValue(DriverConfig.getDriver(),
            TAG_INPUT, ATTR_VALUE, "Find", MEDIUM_TIMEOUT);
    buttonElement.click();
}

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

License:Open Source License

/**
 * Search by email.//from w  w w .j  a va  2s.  c o  m
 * @param emailId the email id
 * @see com.ecofactor.qa.automation.insite.page.UserManagement#searchByEmail(java.lang.String)
 */
public void searchByEmail(final String emailId) {

    DriverConfig.setLogString("Search user by email.", true);
    final WebElement textBoxElement = DriverConfig.getDriver().findElement(By.id("findemail"));
    textBoxElement.sendKeys(emailId);
    DriverConfig.setLogString("Enter email id in search text box: " + emailId, true);
    final WebElement buttonElement = retrieveElementByContainsOfAttributeValue(DriverConfig.getDriver(),
            TAG_INPUT, ATTR_VALUE, "Find", MEDIUM_TIMEOUT);
    buttonElement.click();
}

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

License:Open Source License

/**
 * <p>/*from  w ww  .java  2 s  .  co  m*/
 * As the search results is displayed, this method help to point out the particular user and
 * will click on the Edit button of the selected user.
 * </p>
 * @param accountUserName the account user name
 */
public void verifyUserAndClickEditButton(final String accountUserName) {

    DriverConfig.setLogString(
            "Verify the particular user is listed in the SearchResult and click edit if found.", true);
    DriverConfig.setLogString("Verify search result pagination is displayed.", true);
    retrieveElementByLinkText(DriverConfig.getDriver(), "First", MEDIUM_TIMEOUT);
    final List<WebElement> searchResultList = DriverConfig.getDriver().findElements(By.id("user"));
    boolean searchResultDisplayed = false;
    DriverConfig.setLogString("check if search result displays required user(s).", true);
    for (final WebElement webElement : searchResultList) {
        if (webElement.getText() != null && webElement.getText().contains(accountUserName)) {
            final WebElement anchorElemt = webElement.findElement(By.tagName(TAG_ANCHOR));
            anchorElemt.click();
            searchResultDisplayed = true;
            break;
        }
    }
    if (!searchResultDisplayed) {
        DriverConfig.setLogString("The Search result not found.", true);
    }
}