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

License:Open Source License

/**
 * Select page./*from www. j ava2s . c  o  m*/
 * @param pageName the page name
 */
private void selectPage(String pageName) {

    logger.info("select page from the menu.");
    List<WebElement> menuItems = DriverConfig.getDriver().findElements(By.id(insiteConfig.get(MENU_ID)));
    if (menuItems != null && menuItems.size() > 0) {
        WebElement linkElements = menuItems.get(0);
        List<WebElement> linkElement = linkElements.findElements(By.tagName(TAG_ANCHOR));
        if (linkElement != null && linkElement.size() > 0) {
            for (WebElement element : linkElement) {
                smallWait();
                if (element.getText().equalsIgnoreCase(insiteConfig.get(pageName))) {
                    logger.info("click the menu item");
                    element.click();
                    break;
                }
            }
        }
    }

}

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

License:Open Source License

/**
 * Wizard 6: Test Thermostat./*from  w w  w  .  ja  v a 2  s  . co m*/
 */
private void checkTestThermostats() {

    DriverConfig.setLogString("Select Wizard 6 : Test Thermostat", true);
    DriverConfig.setLogString("Verify the 'Run Test' button is enabled and Click it.", true);
    isDisplayedById(DriverConfig.getDriver(), "tstatSelect_0", MEDIUM_TIMEOUT);
    isEnabledById(DriverConfig.getDriver(), "runTest", MEDIUM_TIMEOUT);
    DriverConfig.getDriver().findElement(By.id("runTest")).click();

    DriverConfig.setLogString("Verify the PopUp is opened", true);
    isEnabledByClassName(DriverConfig.getDriver(), "boxy-content", MEDIUM_TIMEOUT);

    WebElement boxyContent = retrieveElementByAttributeValue(DriverConfig.getDriver(), TAG_TABLE, ATTR_CLASS,
            "boxy-wrapper fixed");

    if (boxyContent.isEnabled()) {
        DriverConfig.setLogString("Click check box and verify the confirm buton is enabled, and click it.",
                true);
        boxyContent.findElement(By.id("confirmeval")).click();
        smallWait();
        DriverConfig.setLogString("Click check box and verify the Agree buton is enabled, and click it.", true);
        isEnabledByIdSubElement(DriverConfig.getDriver(), boxyContent, "iagree_eval", SHORT_TIMEOUT);
        boxyContent.findElement(By.id("iagree_eval")).click();

        DriverConfig.setLogString("Wait until Selection is displayed in Status Column.", true);
        isDisplayedByTagName(DriverConfig.getDriver(), "select", VERY_LONG_TIMEOUT);

        DriverConfig.setLogString("Select Cool Air", true);
        Select select = new Select(DriverConfig.getDriver().findElement(By.tagName("select")));
        select.selectByVisibleText("Cool Air");
        smallWait();

        DriverConfig.setLogString("Click on Re-Test button and wait until selection is re-Enabled.", true);
        WebElement reTest = retrieveElementByAttributeValue(DriverConfig.getDriver(), TAG_INPUT, ATTR_VALUE,
                "Re-Test");
        reTest.click();
        isDisplayedByTagName(DriverConfig.getDriver(), "select", MEDIUM_TIMEOUT);

        DriverConfig.setLogString("Select Hot Air and wait until selection is re-Enabled.", true);
        Select select2 = new Select(DriverConfig.getDriver().findElement(By.tagName("select")));
        select2.selectByVisibleText("Hot Air");
        isDisplayedByTagName(DriverConfig.getDriver(), "select", MEDIUM_TIMEOUT);

        DriverConfig.setLogString("Select again Cool Air wait until Next bnutton is enabled.", true);
        Select select3 = new Select(DriverConfig.getDriver().findElement(By.tagName("select")));
        select3.selectByVisibleText("Cool Air");
        smallWait();

        DriverConfig.setLogString("Click on Next button", true);
        isEnabledById(DriverConfig.getDriver(), installationConfig.get(NEXT_STEP_BUTTON), MEDIUM_TIMEOUT);
        WebElement nextElement = retrieveElementByContainsOfAttributeValue(DriverConfig.getDriver(), TAG_INPUT,
                ATTR_VALUE, "Next ", MEDIUM_TIMEOUT);
        nextElement.click();
        smallWait();

        DriverConfig.setLogString("Verify the Title message in the 7th Wizard.", true);
        isDisplayedByText(DriverConfig.getDriver(), "titleMsg", "one last thing before", MEDIUM_TIMEOUT);
        DriverConfig.setLogString("Verification Mesage - "
                + DriverConfig.getDriver().findElement(By.id("titleMsg")).getText() + "", true);
        smallWait();
    }
}

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

License:Open Source License

/**
 * Verify invalid csv.// ww  w.j  a va2s . c om
 * @return true, if successful
 * @see com.ecofactor.qa.automation.insite.page.OnBoard#verifyInvalidCsv()
 */
public boolean verifyInvalidCsv() {
    smallWait();
    boolean hasErrors = false;
    List<WebElement> strongList = DriverConfig.getDriver().findElements(By.tagName("strong"));
    for (WebElement webElement : strongList) {

        if (webElement.isDisplayed() && webElement.getText().equalsIgnoreCase("Invalid CSV Format.")) {
            hasErrors = true;
        }
    }
    return hasErrors;
}

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

License:Open Source License

/**
 * Click reset password.//from  w  ww . j  a  va  2 s . c om
 * @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

/**
 * Click home owner edit.//  w  w w .  jav  a 2s  . c  o m
 * @see com.ecofactor.qa.automation.insite.page.SupportLookUp#clickHomeOwnerEdit()
 */
public void clickHomeOwnerEdit() {

    tinyWait();
    DriverConfig.setLogString("Click on the Home Owner Link.", true);
    WebElement element = retrieveElementByAttributeValue(DriverConfig.getDriver(), TAG_ANCHOR, ATTR_ID,
            supportConfig.get(HOME_OWNER_LINK));
    element.findElement(By.tagName(TAG_IMG)).click();
}

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

License:Open Source License

/**
 * Click phone number edit.//ww  w. ja va 2 s  .c  om
 * @see com.ecofactor.qa.automation.insite.page.SupportLookUp#clickPhoneNumberEdit()
 */
public void clickPhoneNumberEdit() {

    tinyWait();
    DriverConfig.setLogString("Click on the Phone Number Link.", true);
    WebElement element = retrieveElementByAttributeValue(DriverConfig.getDriver(), TAG_ANCHOR, ATTR_ID,
            supportConfig.get(PHONE_NUMBER_LINK));
    element.findElement(By.tagName(TAG_IMG)).click();
}

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

License:Open Source License

/**
 * Click energy efficiency refresh.//w ww.  j  a v a 2s  . c  o  m
 * @see com.ecofactor.qa.automation.insite.page.SupportLookUp#clickEnergyEfficiencyRefresh()
 */
public void clickEnergyEfficiencyRefresh() {

    tinyWait();
    DriverConfig.setLogString("Click on the Energy Efficiency Refresh.", true);
    WebElement element = containByAttributeValue(DriverConfig.getDriver(), TAG_ANCHOR, ATTR_ID,
            supportConfig.get(ENERGY_EFF_REFRESH), 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 ecp core edit./*www . j a  v a 2  s. c  o  m*/
 * @see com.ecofactor.qa.automation.insite.page.SupportLookUp#clickEcpCoreEdit()
 */
public void clickEcpCoreEdit() {

    tinyWait();
    DriverConfig.setLogString("Click on the ECp Core edit.", true);
    WebElement element = retrieveElementByAttributeValue(DriverConfig.getDriver(), TAG_ANCHOR, ATTR_ID,
            supportConfig.get(ECP_CORE_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 user name edit.//w  w w .  j a  v  a2  s .c  o  m
 * @see com.ecofactor.qa.automation.insite.page.SupportLookUp#clickUserNameEdit()
 */
public void clickUserNameEdit() {

    tinyWait();
    DriverConfig.setLogString("Click on the User Name edit.", true);
    WebElement element = retrieveElementByAttributeValue(DriverConfig.getDriver(), TAG_ANCHOR, ATTR_ID,
            supportConfig.get(USER_NAME_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 email id edit./*from ww w .  j a v  a 2s  . co m*/
 * @see com.ecofactor.qa.automation.insite.page.SupportLookUp#clickEmailIdEdit()
 */
public void clickEmailIdEdit() {

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