List of usage examples for org.openqa.selenium WebElement getText
String getText();
From source file:com.ecofactor.qa.automation.insite.page.RoleManagementImpl.java
License:Open Source License
/** * @param fileName/*from ww w.j a va2s . c o m*/ * @return * @see com.ecofactor.qa.automation.insite.page.RoleManagement#checkUploadedFileInHistory(java.lang.String) */ @Override public boolean checkUploadedFileInHistory(String fileName) { DriverConfig.setLogString("Check File : " + fileName, true); boolean isdisplayed = false; List<WebElement> pgmElements = DriverConfig.getDriver().findElements(By.xpath("//*[@id='user']/td[2]")); for (WebElement webElement : pgmElements) { if (webElement.getText().equalsIgnoreCase(fileName)) { if (webElement.isDisplayed()) { isdisplayed = true; break; } } } return isdisplayed; }
From source file:com.ecofactor.qa.automation.insite.page.SupportLookUpImpl.java
License:Open Source License
/** * Confirm search result value./* w ww . j av a 2 s. com*/ * @param searchResultValue the search result value * @return true, if successful */ public boolean confirmSearchResultValue(final String searchResultValue) { DriverConfig.setLogString( "Verify the search result is displayed and check for required result is populated in the grid.", true); boolean outcome = false; Assert.assertTrue(isMultipleClassNameDisplayed(DriverConfig.getDriver(), supportConfig.get(SEARCH_RESULT_CLASS), MEDIUM_TIMEOUT), "No Result Found"); List<WebElement> resultElements = DriverConfig.getDriver() .findElements(By.className(supportConfig.get(SEARCH_RESULT_CLASS))); for (WebElement webElement : resultElements) { outcome = webElement.getText().contains(searchResultValue) ? true : false; DriverConfig.setLogString("Record Displayed." + searchResultValue, true); if (outcome) return outcome; } DriverConfig.setLogString("verify if result are displayed.", true); Assert.assertEquals(true, resultElements.size() > 0, "Result size is 0"); return outcome; }
From source file:com.ecofactor.qa.automation.insite.page.SupportLookUpImpl.java
License:Open Source License
/** * Verify and log thermostat details.//from w w w. j a v a 2s. co m */ private void verifyAndLogThermostatDetails() { DriverConfig.setLogString("Verify the thermostat device status and Log the details.", true); logger.info("Installed Hardware details."); List<WebElement> noOfInstalledharwareList = DriverConfig.getDriver().findElements(By.id("user")); StringBuffer tableContent = new StringBuffer(); tableContent.append("<table>"); tableContent.append("<tr style='font-weight:bold'>"); tableContent.append("<td>Device"); tableContent.append("</td>"); tableContent.append("<td>Name/ID"); tableContent.append("</td>"); tableContent.append("<td>Model"); tableContent.append("</td>"); tableContent.append("<td>Connectivity"); tableContent.append("</td>"); tableContent.append("</tr>"); for (WebElement webElement : noOfInstalledharwareList) { tableContent.append("<tr>"); List<WebElement> columnList = webElement.findElements(By.className("userinfo")); for (WebElement webElement2 : columnList) { tableContent.append("<td>"); tableContent.append(webElement2.getText()); if (webElement2.getText().isEmpty()) { DriverConfig.setLogString("check if thermostat status image is displayed.", true); WebElement imageElement = retrieveElementByAttributeValueForSubElement(DriverConfig.getDriver(), webElement2, "img", "src", "images", MEDIUM_TIMEOUT); if (imageElement.getAttribute("src").contains("INACTIVE")) { tableContent.append(supportConfig.get(THERMOSTAT_INACTIVE)); } else { tableContent.append(supportConfig.get(THERMOSTAT_ACTIVE)); } } tableContent.append("</td>"); } tableContent.append("</tr>"); } tableContent.append("</table>"); logger.info(tableContent.toString()); }
From source file:com.ecofactor.qa.automation.insite.page.SupportLookUpImpl.java
License:Open Source License
/** * Click searched result element.//from w ww.ja v a 2 s . co m * @param searchResultValue the search result value */ public void clickSearchedResultElement(final String searchResultValue) { logger.info("find search result container."); List<WebElement> resultElements = DriverConfig.getDriver() .findElements(By.className(supportConfig.get(SEARCH_RESULT_CLASS))); DriverConfig.setLogString("find search result shows up proper result and click it.", true); for (WebElement webElement : resultElements) { boolean outcome = webElement.getText().contains(searchResultValue) ? true : false; if (outcome) { webElement.click(); tinyWait(); break; } } }
From source file:com.ecofactor.qa.automation.insite.page.SupportLookUpImpl.java
License:Open Source License
/** * Click pop up cancel.//ww w . jav a2 s . c om * @see com.ecofactor.qa.automation.insite.page.SupportLookUp#clickPopUpCancel() */ public void clickPopUpCancel() { DriverConfig.setLogString("Click on the Pop up Cancel.", true); List<WebElement> listElement = retrieveElementsByAttributeValueList(DriverConfig.getDriver(), TAG_SPAN, ATTR_CLASS, supportConfig.get(OK_BTN)); for (WebElement element : listElement) { if (element.getText().equalsIgnoreCase("Cancel")) { element.click(); } } smallWait(); }
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() *///from w w w. ja va 2s . c o m @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 a v a2 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./* ww w.j a v a 2s. 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
/** * Click energy efficiency check box.// w w w . j av a 2 s .com * @see com.ecofactor.qa.automation.insite.page.SupportLookUp#clickEnergyEfficiencyCheckBox() */ public void clickEnergyEfficiencyCheckBox() { DriverConfig.setLogString("click 'Energy efficiency' check box.", true); WebElement element = retrieveElementByAttributeValue(DriverConfig.getDriver(), TAG_INPUT, ATTR_ID, supportConfig.get(ENERGY_EFF_CHECK), MEDIUM_TIMEOUT); element.click(); tinyWait(); WebElement spanElement = retrieveElementByAttributeValue(DriverConfig.getDriver(), TAG_SPAN, ATTR_ID, "EEText", MEDIUM_TIMEOUT); logger.info("Current EE is -" + spanElement.getText()); if (element.getAttribute("checked") != null) { Assert.assertTrue(spanElement.getText().equalsIgnoreCase("ON")); } else { Assert.assertTrue(spanElement.getText().equalsIgnoreCase("OFF")); } }
From source file:com.ecofactor.qa.automation.insite.page.SupportLookUpImpl.java
License:Open Source License
/** * Verify consumer login.// w w w . jav a 2 s . c o m * @param userId the user id */ public void verifyConsumerLogin(String userId) { DriverConfig.setLogString("Check logout link is present", true); WebElement logoutLink = DriverConfig.getDriver() .findElement(By.cssSelector(loginConfig.get(CONSUMER_LOGOUT_LINK))); assertTrue(logoutLink.isDisplayed() && logoutLink.isEnabled(), "logout link is not available"); DriverConfig.setLogString("Check welcome text in header contains " + userId, true); WebElement welcomeText = DriverConfig.getDriver() .findElement(By.cssSelector(loginConfig.get(CONSUMER_WELCOME_TEXT))); assertTrue(welcomeText.getText().contains(userId), "welcome text doesn't contain the user"); user = userId; DriverConfig.setLogString("Login success for " + user, true); }