Example usage for org.openqa.selenium WebElement getText

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

Introduction

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

Prototype

String getText();

Source Link

Document

Get the visible (i.e.

Usage

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

License:Open Source License

/**
 * Gets the error message./*from   w ww .  j  a v  a 2  s.  c  om*/
 * @return the error message
 * @see com.ecofactor.qa.automation.insite.page.SupportLookUp#getErrorMessage()
 */
public String getErrorMessage() {

    DriverConfig.setLogString("Check for error message", true);
    String validationMsg = "";
    List<WebElement> errorLabels = retrieveElementsByAttributeValueList(DriverConfig.getDriver(), TAG_DIV,
            ATTR_CLASS, supportConfig.get(ERROR));
    for (WebElement webElement : errorLabels) {
        validationMsg += webElement.getText();
    }
    DriverConfig.setLogString("Error message : " + validationMsg, true);
    return validationMsg;
}

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

License:Open Source License

/**
 * Verify error message./*from w  ww.j a  v a2 s  .c om*/
 * @return the string
 * @see com.ecofactor.qa.automation.insite.page.SupportLookUp#verifyErrorMessage()
 */
@Override
public String verifyErrorMessage() {

    DriverConfig.setLogString("Check for error message", true);
    String validationMsg = "";
    List<WebElement> errorLabels = retrieveElementsByAttributeValueList(DriverConfig.getDriver(), TAG_DIV,
            ATTR_CLASS, supportConfig.get(PHONE_ERROR));
    for (WebElement webElement : errorLabels) {
        validationMsg += webElement.getText();
    }
    DriverConfig.setLogString("Error message : " + validationMsg, true);
    return validationMsg;
}

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

License:Open Source License

/**
 * Click OK button.//from   w  w w .ja v a 2 s .c om
 */
public void clickOkBtn() {

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

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

License:Open Source License

/**
 * Close popup.//  ww w  . j ava2  s.  c o  m
 */
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

/**
 * Gets the ecp./*from  w w w  .  ja va2s . c  o m*/
 * @return the ecp
 * @see com.ecofactor.qa.automation.insite.page.SupportLookUp#getEcp()
 */
@Override
public String getEcp() {

    WebElement ecpText = DriverConfig.getDriver().findElement(By.id("ecpCore"));
    DriverConfig.setLogString("Ecp : " + ecpText.getText(), true);
    return ecpText.getText();
}

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

License:Open Source License

/**
 * Gets the location name./* w w  w  . j  a v  a2  s  . c o  m*/
 * @return the location name
 * @see com.ecofactor.qa.automation.insite.page.SupportLookUp#getLocationName()
 */
@Override
public String getLocationName() {

    WebElement locName = DriverConfig.getDriver().findElement(By.id("locationNam"));
    DriverConfig.setLogString("Location Name : " + locName.getText(), true);
    return null;
}

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

License:Open Source License

/**
 * Verify account details./*from  ww  w  .j  a v a 2  s .c o  m*/
 * @see com.ecofactor.qa.automation.insite.page.UserManagement#verifyAccountDetails()
 */
public void verifyAccountDetails() {

    DriverConfig.setLogString("Verify account details.", true);
    final List<WebElement> filterLabelClass = DriverConfig.getDriver()
            .findElements(By.className("filterLabel"));
    final List<WebElement> filterInputClass = DriverConfig.getDriver()
            .findElements(By.className("filterInput"));
    WebElement filterInput = null;
    int loopVal = 0;
    final List<String> accountFieldList = getAcountFieldList();
    for (final WebElement filterLabel : filterLabelClass) {
        filterInput = filterInputClass.get(loopVal);
        final String labelText = filterLabel.getText();
        final String inputText = filterInput.getText();
        if (accountFieldList.contains(labelText)) {
            logger.info("Label Name : " + labelText);
            logger.info("Input Name : " + inputText);
            assertTrue(inputText != null && !inputText.isEmpty(), "Input name is not available");
        }
        loopVal++;
    }
}

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

License:Open Source License

/**
 * Verify role details./*  www . j a  v a2 s  . c  o  m*/
 * @see com.ecofactor.qa.automation.insite.page.UserManagement#verifyRoleDetails()
 */
public void verifyRoleDetails() {

    DriverConfig.setLogString("Verify role details.", true);
    clickRoleTab();
    tinyWait();

    final List<WebElement> assignedRoles = retrieveElementsByContainsOfAttributeValue(DriverConfig.getDriver(),
            TAG_TD, ATTR_CLASS, "userinfo bgnone");
    int roleLoop = 0;
    for (final WebElement webElement : assignedRoles) {
        if (roleLoop == 0) {
            DriverConfig.setLogString("Role Name - " + webElement.getText(), true);
        } else {
            DriverConfig.setLogString("Role Description - " + webElement.getText(), true);
            roleLoop = 0;
        }
        roleLoop++;
    }
}

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

License:Open Source License

/**
 * <p>/*  ww  w  . ja v  a2  s .c o 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);
    }
}

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

License:Open Source License

/**
 * Verify the role is assigned and reassign the role.
 * @param assignedRole the assigned role
 */// www .j  av  a 2 s . c o  m
@Override
public void verifyAndReAssignRole(final String assignedRole) {

    clickRoleTab();

    DriverConfig.setLogString("check if assigned roles element is displayed.", true);
    DriverConfig.setLogString("Assigned Role " + assignedRole, true);
    isDisplayedById(DriverConfig.getDriver(), userConfig.get(ASSIGNED_ROLES), MEDIUM_TIMEOUT);

    final Select select = new Select(
            DriverConfig.getDriver().findElement(By.id(userConfig.get(ASSIGNED_ROLES))));

    final List<WebElement> optionsList = select.getOptions();
    for (final WebElement webelement : optionsList) {
        if (webelement.getText().equalsIgnoreCase(assignedRole)) {
            Assert.assertTrue(true);
            DriverConfig.setLogString("Assigned role is verified, and the role is :" + webelement.getText(),
                    true);
        }

    }

    DriverConfig.setLogString("ReAssign the selected Role", true);
    select.deselectAll();
    DriverConfig.setLogString("select required role " + assignedRole, true);
    select.selectByVisibleText(assignedRole);
    DriverConfig.setLogString("click on remove button.", true);
    DriverConfig.getDriver().findElement(By.id("remove")).click();
    smallWait();
}