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

License:Open Source License

/**
 * Checks if is second page displayed.//from  www  .j  a v  a  2 s .  c  o  m
 * @return true, if is second page displayed
 * @see com.ecofactor.qa.automation.insite.page.PartnerManagement#isSecondPageDisplayed()
 */
@Override
public boolean isSecondPageDisplayed() {

    LogUtil.setLogString("Check either page is in 2nd page", true);
    WaitUtil.smallWait();
    final WebElement firstPage = retrieveElementByContainsOfAttributeValue(DriverConfig.getDriver(), TAG_TD,
            ATTR_CLASS, "ef_smallLabel", SHORT_TIMEOUT);
    System.out.println(firstPage.getText() + "fsdf" + firstPage.getAttribute("class"));
    return true;
}

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

License:Open Source License

/**
 * <p>// w  w  w  .  ja  v  a2s.  c o m
 * Remove all values from the assigned panel to the available panel and verify there is no value
 * in the assigned pane.
 * </p>
 * @param driver the driver
 */
private void removeAllToAvailablePane(final WebDriver driver) {

    LogUtil.setLogString("Remome all values from the assigned Pane and moving to available pane", true);
    final Select select = new Select(driver.findElement(By.id(partnerConfig.get(ASSIGNED_PARTNER_TYPE))));

    final List<WebElement> optionsList = select.getOptions();

    for (final WebElement webElement : optionsList) {
        select.selectByVisibleText(webElement.getText());
        driver.findElement(By.id(REMOVE_ASSIGNED_ROLE)).click();
    }

    final List<WebElement> optionsList2 = select.getOptions();
    (new WebDriverWait(driver, SHORT_TIMEOUT)).until(new ExpectedCondition<Boolean>() {
        public Boolean apply(WebDriver d) {

            boolean outcome = false;
            outcome = optionsList2.size() == 0 ? true : false;
            return outcome;
        }
    });
}

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

License:Open Source License

/**
 * Gets the menu.//w w w.j a v a2s . co m
 * @return the menu
 * @see com.ecofactor.qa.automation.insite.page.RoleManagement#getMenu()
 */
@Override
public List<WebElement> getMenu() {

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

    return menus;
}

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

License:Open Source License

/**
 * Gets the sub menu.//from  w w w.  j  a v  a2 s  . c  om
 * @return the sub menu
 * @see com.ecofactor.qa.automation.insite.page.RoleManagement#getSubMenu()
 */
@Override
public List<WebElement> getSubMenu() {

    final List<WebElement> subMenus = DriverConfig.getDriver().findElements(By.xpath("//*[@id='submenu']/a"));
    if (subMenus != null) {
        for (final WebElement webElement : subMenus) {
            DriverConfig.setLogString("SubMenu :" + webElement.getText(), true);
        }
    }
    return subMenus;
}

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

License:Open Source License

/**
 * Click top first user.//  w w w  .ja va 2  s.  c  om
 * @see com.ecofactor.qa.automation.insite.page.RoleManagement#clickTopFirstUser()
 */
@Override
public void clickTopFirstUser() {

    DriverConfig.setLogString("Click top first user.", true);
    smallWait();
    final List<WebElement> userRow = DriverConfig.getDriver().findElements(By.id("user"));
    for (int i = 0; i < userRow.size(); i++) {

        WebElement subElement = retrieveElementByAttributeValueContainsForSubElement(DriverConfig.getDriver(),
                userRow.get(i), TAG_ANCHOR, ATTR_HREF, "javascript", MEDIUM_TIMEOUT);
        if (subElement != null && !subElement.getText().isEmpty()) {
            subElement.click();
            break;
        }
    }

    tinyWait();
}

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

License:Open Source License

/**
 * Check menu./*  w  ww .j a v  a2  s. c om*/
 * @param menu the menu
 * @param isdisplayed the isdisplayed
 * @param menus the menus
 * @return true, if successful
 */
private boolean checkMenu(final String menu, boolean isdisplayed, final List<WebElement> menus) {

    if (menus != null) {
        for (final WebElement webElement : menus) {
            if (webElement.getText().equalsIgnoreCase(menu) && webElement.isDisplayed()) {

                isdisplayed = true;
                break;
            }
        }
    }
    return isdisplayed;
}

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

License:Open Source License

/**
 * <p>/*from   www .j  a  va 2 s .com*/
 * Verify the Search is populated with the value included in the textField.
 * </p>
 * @param driver the driver
 * @param searchResultValue the search result value
 * @return boolean
 */
private boolean confirmSearchResultValue(final WebDriver driver, final String searchResultValue) {

    DriverConfig.setLogString("Confirm Serach result as " + searchResultValue, true);
    boolean outcome = false;
    DriverConfig.setLogString("check if multiple results are displayed.", true);
    isMultipleClassNameDisplayed(driver, roleConfig.get(SEARCH_RESULT_CLASS), MEDIUM_TIMEOUT);

    final List<WebElement> resultElements = driver
            .findElements(By.className(roleConfig.get(SEARCH_RESULT_CLASS)));
    DriverConfig.setLogString("check if results displayed are relevent to provided search value.", true);
    for (final WebElement webElement : resultElements) {
        outcome = webElement.getText().contains(searchResultValue) ? true : false;
        DriverConfig.setLogString("Displayed Result." + searchResultValue, true);
        if (outcome) {
            return outcome;
        }
    }
    DriverConfig.setLogString("check if results are displayed.", true);
    Assert.assertEquals(true, resultElements.size() > 0, "Result size is zero");
    return outcome;
}

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

License:Open Source License

/**
 * Check ecp./* ww w  . ja v  a  2 s.  c om*/
 * @return true, if successful
 * @see com.ecofactor.qa.automation.insite.page.RoleManagement#checkEcp()
 */
@Override
public boolean checkEcp() {

    DriverConfig.setLogString("Check Ecp.", true);
    boolean isEcp = true;
    List<WebElement> userRow = DriverConfig.getDriver().findElements(By.id("user"));
    for (int i = 0; i < userRow.size(); i++) {
        userRow = DriverConfig.getDriver().findElements(By.id("user"));
        WebElement subElement = retrieveElementByAttributeValueContainsForSubElement(DriverConfig.getDriver(),
                userRow.get(i), TAG_ANCHOR, ATTR_HREF, "javascript", SHORT_TIMEOUT);
        if (subElement != null && !subElement.getText().isEmpty()) {
            subElement.click();
            tinyWait();
            WebElement ecpText = DriverConfig.getDriver().findElement(By.id("ecpCore"));
            DriverConfig.setLogString("ECP TEXT : " + ecpText.getText(), true);
            if (!ecpText.getText().contains("199")) {
                isEcp = false;
                break;
            }
            DriverConfig.getDriver().findElement(By.className("subNavOn")).click();
            tinyWait();
            clickFind();
            tinyWait();
        }
    }

    return isEcp;
}

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

License:Open Source License

/**
 * Click menu.//from ww  w . jav a 2 s .c  o m
 * @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./*from  ww  w  .j  a  v a  2 s.com*/
 * @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();

}