List of usage examples for org.openqa.selenium WebElement getText
String getText();
From source file:com.ecofactor.qa.automation.newapp.page.impl.LocationSwitcherUIPageImpl.java
License:Open Source License
/** * Gets the temp by tstat id./*w w w .j av a2 s .co m*/ * @param tstatId the tstat id * @param tempType the temp type * @return the temp by tstat id * @see com.ecofactor.qa.automation.newapp.page.LocationSwitcherUIPage#getTempByTstatId(Integer, * java.lang.String) */ @Override public String getTempByTstatId(final Integer tstatId, final TemperatureType tempType) { LogUtil.setLogString("Get Temperature for tstatId :" + tstatId, true, CustomLogLevel.LOW); final WebElement tstatElement = getElementByAttr(getDriver(), By.cssSelector(THERMOSTAT_ROW), THERMOSTAT_ID, tstatId.toString(), SHORT_TIMEOUT); final WebElement statusElement = getElementBySubElement(getDriver(), tstatElement, By.className(THERMOSTAT_STATUS), SHORT_TIMEOUT); final String statusText = statusElement.getText(); String temperature = ""; if (statusText != null && !statusText.isEmpty() && !statusText.equals("--")) { temperature = getTemperature(tempType, temperature, statusText); } else if (statusText != null && !statusText.isEmpty() && statusText.equals("--")) { temperature = "--"; } LogUtil.setLogString("The Temperature is :" + temperature, true, CustomLogLevel.LOW); return temperature; }
From source file:com.ecofactor.qa.automation.newapp.page.impl.LocationSwitcherUIPageImpl.java
License:Open Source License
/** * Gets the tstat namesin location.//from ww w.j a v a2 s. c o m * @param locId the loc id * @return the tstat namesin location * @see com.ecofactor.qa.automation.newapp.page.LocationSwitcherUIPage#getTstatNamesinLocation(Integer) */ @Override public List<String> getTstatNamesinLocation(final Integer locId) { LogUtil.setLogString("Get Thermostat Names for location id :" + locId, true, CustomLogLevel.LOW); final WebElement thermostatSwitcherContainer = getElement(getDriver(), By.className(THERMOSTAT_SWITCHER_CONTAINER), SHORT_TIMEOUT); final List<WebElement> tstatName = getElementsBySubElement(getDriver(), thermostatSwitcherContainer, By.cssSelector(THERMOSTAT_ROW), SHORT_TIMEOUT); final List<String> tstatNames = new ArrayList<String>(); for (final WebElement element1 : tstatName) { final String locId1 = element1.getAttribute(LOCATION_ID); if (locId1.equalsIgnoreCase(String.valueOf(locId))) { final WebElement tstatName1 = getElementBySubElement(getDriver(), element1, By.className(THERMOSTAT_NAME), SHORT_TIMEOUT); tstatNames.add(tstatName1.getText()); } } return tstatNames; }
From source file:com.ecofactor.qa.automation.newapp.page.impl.LocationSwitcherUIPageImpl.java
License:Open Source License
/** * Gets the rangeof temperature./* w w w . j a va 2s .c o m*/ * @param tstatId the tstat id * @return the rangeof temperature * @see com.ecofactor.qa.automation.newapp.page.LocationSwitcherUIPage#getRangeofTemperature(java.lang.Integer) */ @Override public String getRangeofTemperature(Integer tstatId) { LogUtil.setLogString("Get Range of Temperature for thermostat :" + tstatId, true, CustomLogLevel.LOW); final WebElement tstatElement = getElementByAttr(getDriver(), By.cssSelector(THERMOSTAT_ROW), THERMOSTAT_ID, tstatId.toString(), SHORT_TIMEOUT); final WebElement tstatStatusElement = getElementBySubElement(getDriver(), tstatElement, By.className(THERMOSTAT_STATUS), SHORT_TIMEOUT); String statusText = tstatStatusElement.getText(); if (statusText.equalsIgnoreCase("--")) { LogUtil.setLogString("The Range is " + statusText, true, CustomLogLevel.LOW); } else if (statusText != null && !statusText.isEmpty() && !statusText.equalsIgnoreCase("--")) { statusText = getRange(statusText); LogUtil.setLogString("The Range is " + statusText, true, CustomLogLevel.LOW); } return statusText; }
From source file:com.ecofactor.qa.automation.newapp.page.impl.LoginPageImpl.java
License:Open Source License
/** * Gets the error message.//from www . j a va 2 s . co m * @return the error message * @see com.ecofactor.qa.automation.mobile.page.LoginPage#getErrorMessage() */ @Override public String getErrorMessage() { String errorMsg = ""; isDisplayed(getDriver(), By.className(LOGIN_RESPONSE), MEDIUM_TIMEOUT); final WebElement loginResponse = getDriver().findElement(By.className(LOGIN_RESPONSE)); if (!loginResponse.getText().isEmpty()) { LogUtil.setLogString("Error Message : " + loginResponse.getText(), true, CustomLogLevel.LOW); errorMsg = loginResponse.getText(); } return errorMsg; }
From source file:com.ecofactor.qa.automation.newapp.page.impl.LoginPageImpl.java
License:Open Source License
/** * fetching the version Name.// w w w . j ava 2 s .c om * @return string. * @see com.ecofactor.qa.automation.newapp.page.LoginPage#versionName() */ @Override public String versionName() { LogUtil.setLogString("Fetch version Name", true); clickNeedHelp(); final WebElement versionElement = getElement(getDriver(), By.className(VERSION_NAME), MEDIUM_TIMEOUT); final String version_name = versionElement.getText(); LogUtil.setLogString("Version Name:" + version_name, true); return version_name; }
From source file:com.ecofactor.qa.automation.newapp.page.impl.SetAwayPageImpl.java
License:Open Source License
/** * Gets the away settings.//from w ww .j a v a 2 s .c o m * @return the away settings */ @Override public String[] getActualAwaySettings() { final WebElement awayInfoText = getElementBySubElement(getDriver(), getCurrentThermostatContainer(), By.className(TSTAT_POPUP_LABEL), TINY_TIMEOUT); final String[] awayInfo = awayInfoText.getText().split(" "); return awayInfo; }
From source file:com.ecofactor.qa.automation.newapp.page.impl.SetAwayPageImpl.java
License:Open Source License
/** * Checks whether the Away Date is valid or not. * @return the validity status of Away Date * @see com.ecofactor.qa.automation.newapp.page.SetAwayPage#isDateValidForAway *///from w w w. ja va2s . com @Override public boolean isDateValidForAway() { Date currentDate = null; Date newDate = null; final WebElement dateTimePickerButton = getElement(getDriver(), By.cssSelector(".setAwayPicker.awayEndDateTimePicker"), TINY_TIMEOUT); String currentDateString = dateTimePickerButton.getText(); currentDateString = currentDateString.substring(currentDateString.indexOf("-") + 2); try { currentDate = new SimpleDateFormat("MMM dd, yyyy").parse(currentDateString); } catch (Exception ex) { setLogString("Exception:" + ex, true); } setLogString("Value:" + currentDate, true); dateTimePickerButton.click(); setLogString("Set Date Scroll Control Displayed:" + isDisplayed(getDriver(), By.cssSelector("a.dwb-e.dwwb.dwwbm"), TINY_TIMEOUT), true); setLogString("Trying to set a past date for Away", true); final WebElement dateScroll = getElement(getDriver(), By.cssSelector(".dwwl1 > a:nth-child(2)"), TINY_TIMEOUT); dateScroll.click(); WaitUtil.tinyWait(); setLogString("Set the New Date Value", true); final WebElement setElement = getElement(getDriver(), By.cssSelector("a.dwb.dwb0.dwb-e"), TINY_TIMEOUT); getAction().click(setElement); String newDateString = dateTimePickerButton.getText(); newDateString = newDateString.substring(newDateString.indexOf("-") + 2); WaitUtil.tinyWait(); try { newDate = new SimpleDateFormat("MMM dd, yyyy").parse(newDateString); } catch (Exception ex) { setLogString("Exception:" + ex, true); } setLogString("New Value:" + newDate, true); if (currentDate.compareTo(newDate) < 0 || currentDate.compareTo(newDate) == 0) { return true; } else { return false; } }
From source file:com.ecofactor.qa.automation.newapp.page.impl.SetAwayPageImpl.java
License:Open Source License
/** * Alert message./*w w w.ja va 2 s.com*/ * @return true, if successful. * @see com.ecofactor.qa.automation.newapp.page.SetAwayPage#alertMessage() */ @Override public boolean alertMessage() { setLogString("Verify with alert Message", true, CustomLogLevel.MEDIUM); final boolean alertValue = isDisplayed(getDriver(), By.cssSelector(".settings_alert_label"), TINY_TIMEOUT); if (alertValue) { final WebElement alertMessage = getElement(getDriver(), By.cssSelector(".settings_alert_label"), TINY_TIMEOUT); setLogString("Alert Message" + alertMessage.getText(), true, CustomLogLevel.MEDIUM); } return true; }
From source file:com.ecofactor.qa.automation.newapp.page.impl.SettingsPageImpl.java
License:Open Source License
/** * Verify fields in password tab.//from w ww . j a v a2 s .c om * @return true, if successful * @see com.ecofactor.qa.automation.newapp.page.SettingsPage#VerifyFieldsInPasswordTab() */ @Override public boolean VerifyFieldsInPasswordTab() { setLogString("Verify fields are in password tab", true, CustomLogLevel.LOW); boolean fieldsDisplayed = false; final WebElement fields = getElement(getDriver(), By.cssSelector(ELEMENTS), TINY_TIMEOUT); final String className = ".prompt.old_password,.prompt.new_password,.prompt.confirm_new_password"; String values = ""; final StringTokenizer stringTokenizer = new StringTokenizer(className, ","); while (stringTokenizer.hasMoreElements()) { values = stringTokenizer.nextToken(); final WebElement textFiled = getElementBySubElement(getDriver(), fields, By.cssSelector(values), TINY_TIMEOUT); setLogString("Text Fields in Password Tab" + textFiled.getText(), true, CustomLogLevel.LOW); fieldsDisplayed = isDisplayed(getDriver(), By.cssSelector(values), TINY_TIMEOUT); } return fieldsDisplayed && isDisplayed(getDriver(), By.cssSelector(BUTTON), TINY_TIMEOUT); }
From source file:com.ecofactor.qa.automation.newapp.page.impl.SettingsPageImpl.java
License:Open Source License
/** * Gets the thermostat name.//from w w w. j a va 2s. c o m * @return the thermostat name * @see com.ecofactor.qa.automation.newapp.page.SettingsPage#getThermostatName() */ @Override public String getThermostatName() { setLogString("Get Thermostat Name from Settings page", true, CustomLogLevel.LOW); final WebElement thermostatName = getElement(getDriver(), By.cssSelector(THERMOSTAT_NAME), TINY_TIMEOUT); setLogString("Thermostat Name from settings page: " + thermostatName.getText(), true, CustomLogLevel.LOW); return thermostatName.getText(); }