Example usage for org.openqa.selenium By tagName

List of usage examples for org.openqa.selenium By tagName

Introduction

In this page you can find the example usage for org.openqa.selenium By tagName.

Prototype

public static By tagName(String tagName) 

Source Link

Usage

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

License:Open Source License

/**
 * Click electricity rate edit./*from w w  w .ja v  a 2 s  .c o m*/
 * @see com.ecofactor.qa.automation.insite.page.SupportLookUp#clickElectricityRateEdit()
 */
public void clickElectricityRateEdit() {

    tinyWait();
    DriverConfig.setLogString("Click on the Electricity Rate edit.", true);
    WebElement element = retrieveElementByAttributeValue(DriverConfig.getDriver(), TAG_ANCHOR, ATTR_ID,
            supportConfig.get(ELECTRICITY_RATE_LINK), MEDIUM_TIMEOUT);
    element.findElement(By.tagName(TAG_IMG)).click();
}

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

License:Open Source License

/**
 * Click gas rate edit./* w w  w .ja v a 2 s .c  om*/
 * @see com.ecofactor.qa.automation.insite.page.SupportLookUp#clickGasRateEdit()
 */
public void clickGasRateEdit() {

    tinyWait();
    DriverConfig.setLogString("Click on the Gas Rate edit.", true);
    WebElement element = retrieveElementByAttributeValue(DriverConfig.getDriver(), TAG_ANCHOR, ATTR_ID,
            supportConfig.get(GAS_RATE_LINK), MEDIUM_TIMEOUT);
    element.findElement(By.tagName(TAG_IMG)).click();
}

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

License:Open Source License

/**
 * Iterate results and verify empty fields.
 * @see com.ecofactor.qa.automation.insite.page.SupportLookUp#iterateResultsAndVerifyEmptyFields()
 *///  w  w  w. ja va2  s.c om
@Override
public void iterateResultsAndVerifyEmptyFields() {

    DriverConfig.setLogString("Iterate Search Results and Verify empty results", true);
    List<WebElement> resultTr = retrieveElementsByAttributeValueList(DriverConfig.getDriver(), "tr", "id",
            "user");
    boolean gateWayModelFound = false;
    String text = "";
    for (WebElement trElement : resultTr) {

        if (gateWayModelFound)
            break;
        List<WebElement> resultTd = trElement.findElements(By.tagName("td"));
        int count = 0;
        for (WebElement tdElement : resultTd) {
            if (count == 9)
                text = tdElement.getText();

            logger.info("Account status: " + text);
            if (text.contains("ACTIVE")) {
                WebElement idElement = resultTd.get(0);
                WebElement searchElement = retrieveElementByLinkText(DriverConfig.getDriver(),
                        idElement.getText(), MEDIUM_TIMEOUT);
                logger.info("click active account.", true);
                searchElement.click();
                WaitUtil.waitUntil(200);

                DriverConfig.setLogString("click Installed Hardware.", true);
                retrieveElementByLinkText(DriverConfig.getDriver(), "Installed Hardware", MEDIUM_TIMEOUT)
                        .click();
                WaitUtil.waitUntil(200);

                WebElement gateWayDiv = retrieveElementByAttributeValue(DriverConfig.getDriver(), TAG_DIV,
                        ATTR_ID, "supportPage-gatewayDetails", MEDIUM_TIMEOUT);
                DriverConfig.setLogString("click Expand Gateway." + gateWayDiv.getTagName(), true);

                retrieveElementByAttributeValueContainsForSubElement(DriverConfig.getDriver(), gateWayDiv,
                        TAG_IMG, ATTR_CLASS, "show", MEDIUM_TIMEOUT).click();
                WaitUtil.waitUntil(200);

                DriverConfig.setLogString("Verify Gateway model.", true);
                List<WebElement> elementTD = retrieveElementsByTagText(DriverConfig.getDriver(), TAG_TD,
                        "iControl Android Touchscreen");

                for (WebElement element : elementTD) {
                    DriverConfig.setLogString("element.getText() " + element.getText(), true);
                    gateWayModelFound = true;
                    break;
                }
                break;
            }
            count++;
        }
    }
    DriverConfig.setLogString("Check if gateway model 'iControl Android Touchscreen' found.", true);
    Assert.assertTrue(gateWayModelFound, "Gateway model 'iControl Android Touchscreen' not found.");
}

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

License:Open Source License

/**
 * Iterate results and verify comcast id.
 * @see com.ecofactor.qa.automation.insite.page.SupportLookUp#iterateResultsAndVerifyComcastId()
 *///from   w  w  w. j  av  a  2  s.c  o m
@Override
public void iterateResultsAndVerifyComcastId() {

    DriverConfig.setLogString("Iterate Search Results and verify ComcastId", true);
    List<WebElement> resultTr = retrieveElementsByAttributeValueList(DriverConfig.getDriver(), "tr", "id",
            "user");
    for (WebElement trElement : resultTr) {
        logger.info("tr id: " + trElement.getAttribute("id"));
        List<WebElement> resultTd = trElement.findElements(By.tagName("td"));
        int i = 0;
        for (WebElement td : resultTd) {
            if (i == 0) {
                Assert.assertFalse(td.getText().isEmpty(), "Search result is empty");
            }
            i++;
        }
    }
}

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

License:Open Source License

/**
 * Click top first user./*from  ww w  .j  a va2  s. co m*/
 * @see com.ecofactor.qa.automation.insite.page.SupportLookUp#clickTopFirstUser()
 */
@Override
public void clickTopFirstUser() {

    DriverConfig.setLogString("Click Top First User", true);
    WebElement tagTable = retrieveElementByAttributeValue(DriverConfig.getDriver(), "table", "id", "user");
    WebElement tagTbody = tagTable.findElement(By.tagName("tbody"));
    List<WebElement> resultTr = tagTbody.findElements(By.tagName("tr"));
    boolean lookUpFound = false;
    for (WebElement trElement : resultTr) {
        List<WebElement> resultTd = trElement.findElements(By.tagName("td"));

        for (WebElement td : resultTd) {

            Assert.assertFalse(td.getText().isEmpty(), "Search result is empty");

            logger.info("name link: " + td.getText());
            td.findElement(By.tagName(TAG_ANCHOR)).click();
            smallWait();
            DriverConfig.setLogString("Verify istalled harware menu is displyed.", true);
            WebElement accountDetails = DriverConfig.getDriver()
                    .findElement(By.id("supportPage-accountDetails"));
            Assert.assertTrue(accountDetails.isDisplayed(), "Account details is not displayed");
            lookUpFound = true;
            break;

        }
        if (lookUpFound)
            break;
    }

}

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

License:Open Source License

/**
 * Check for top first user./*w w  w.j  a  va  2 s  .c  o m*/
 * @param searchName the search name
 * @return true, if successful
 * @see com.ecofactor.qa.automation.insite.page.SupportLookUp#checkForTopFirstUser()
 */
@Override
public boolean checkForTopFirstUser(final String searchName) {

    DriverConfig.setLogString("Check Top First User", true);
    WebElement tagTable = retrieveElementByAttributeValue(DriverConfig.getDriver(), "table", "id", "user");
    WebElement tagTbody = tagTable.findElement(By.tagName("tbody"));
    List<WebElement> resultTr = tagTbody.findElements(By.tagName("tr"));

    for (WebElement trElement : resultTr) {
        List<WebElement> resultTd = trElement.findElements(By.tagName("td"));

        for (@SuppressWarnings("unused")
        WebElement td : resultTd) {

            isDisplayedByTagName(DriverConfig.getDriver(), TAG_ANCHOR, SHORT_TIMEOUT);
            smallWait();
            // DriverConfig.setLogString("Verify istalled harware menu is displyed.", true);
            break;
        }
    }
    logger.info("Top First User : " + searchName);
    return true;
}

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

License:Open Source License

/**
 * <p>/* w  ww.ja va2 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);
    }
}

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

License:Open Source License

/**
 * Read temperature./*from   w ww  .j  ava 2s  .  c  o  m*/
 * @return the string
 * @see com.ecofactor.qa.automation.newapp.admin.page.AdminDialoguePage#readTemperature()
 */
@Override
public String readTemperature() {

    setLogString("Read temperature", true);
    final WebElement tempElement = getElements(popup, By.className(BLOCK), SHORT_TIMEOUT).get(1);
    final String value = getElementBySubElement(popup, tempElement, By.tagName(TAG_SPAN), SHORT_TIMEOUT)
            .getText();
    final String[] tempValue = value.split(":");
    setLogString("Hexa decimal value: " + tempValue[1].trim(), true);
    return tempValue[1].trim();
}

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

License:Open Source License

/**
 * Checks if is page loaded.//from  ww  w .  j  av a2 s . co  m
 * @return true, if checks if is page loaded
 * @see com.ecofactor.qa.automation.newapp.page.BasePage#isPageLoaded()
 */
@Override
public boolean isPageLoaded() {

    setLogString("Check if login success.", true);
    final boolean pageLoaded = isDisplayed(driverManager.getAdminDriver(), By.id(ACCOUNTS_NAV), SHORT_TIMEOUT);
    getElement(driverManager.getAdminDriver(), By.id(ACCOUNTS_NAV), SHORT_TIMEOUT).click();
    adminLogin.setLoggedIn(pageLoaded);
    driverManager.getAdminDriver().switchTo().frame(0);
    formElement = getElement(driverManager.getAdminDriver(), By.tagName(FORM), TINY_TIMEOUT);
    return pageLoaded;
}

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

License:Open Source License

/**
 * Select accountslink.//from  w ww  .j av  a  2s .  c  o m
 * @see com.ecofactor.qa.automation.newapp.admin.page.AdminHomePage#selectAccountslink()
 */
@Override
public void selectAccountslink() {

    setLogString("Select accounts link.", true);
    getElement(driverManager.getAdminDriver(), By.id(ACCOUNTS_NAV), TINY_TIMEOUT).click();
    mediumWait();
    driverManager.getAdminDriver().switchTo().frame(0);
    formElement = getElement(driverManager.getAdminDriver(), By.tagName(FORM), TINY_TIMEOUT);
}