List of usage examples for org.openqa.selenium By className
public static By className(String className)
From source file:com.ecofactor.qa.automation.newapp.page.impl.LocationSwitcherUIPageImpl.java
License:Open Source License
/** * Gets the location names./* w w w.j a v a 2s .co m*/ * @return the location names * @see com.ecofactor.qa.automation.newapp.page.LocationSwitcherUIPage#getLocationNames() */ @Override public List<String> getLocationNames() { LogUtil.setLogString("Get location names list", true, CustomLogLevel.LOW); final WebElement thermostatSwitcherContainer = getElement(getDriver(), By.className(THERMOSTAT_SWITCHER_CONTAINER), SHORT_TIMEOUT); final List<WebElement> locationElements = getElementsBySubElement(getDriver(), thermostatSwitcherContainer, By.className(LOCATION_ROW), SHORT_TIMEOUT); final List<String> locNames = new ArrayList<String>(); for (final WebElement element : locationElements) { locNames.add(element.getText()); } return locNames; }
From source file:com.ecofactor.qa.automation.newapp.page.impl.LocationSwitcherUIPageImpl.java
License:Open Source License
/** * Gets the tstat name by id./*from w w w. j a v a2 s . c om*/ * @param tstatId the tstat id * @return the tstat name by id * @see com.ecofactor.qa.automation.newapp.page.LocationSwitcherUIPage#getTstatNameById(Integer) */ @Override public String getTstatNameById(final Integer tstatId) { LogUtil.setLogString("Get Thermostat Name for tstatId :" + tstatId, true, CustomLogLevel.LOW); final WebElement tstatElement = getElementByAttr(getDriver(), By.cssSelector(THERMOSTAT_ROW), THERMOSTAT_ID, tstatId.toString(), SHORT_TIMEOUT); final WebElement tstatNameElement = getElementBySubElement(getDriver(), tstatElement, By.className(THERMOSTAT_NAME), SHORT_TIMEOUT); return tstatNameElement.getText(); }
From source file:com.ecofactor.qa.automation.newapp.page.impl.LocationSwitcherUIPageImpl.java
License:Open Source License
/** * Gets the temp by tstat id.//from ww w . j a v a 2 s . c o 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 w w w. j ava 2 s .co 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 tstat id for location./*from ww w .j a v a 2 s. c om*/ * @param locId the loc id * @return the tstat id for location * @see com.ecofactor.qa.automation.newapp.page.LocationSwitcherUIPage#getTstatIdForLocation(java.lang.Integer) */ @Override public List<Integer> getTstatIdForLocation(final Integer locId) { LogUtil.setLogString("Get Thermostat Id 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<Integer> tstatIdList = new ArrayList<Integer>(); for (final WebElement element1 : tstatName) { final String locId1 = element1.getAttribute(LOCATION_ID); if (locId1.equalsIgnoreCase(String.valueOf(locId))) { final Integer tstatId = Integer.valueOf(element1.getAttribute(THERMOSTAT_ID)); tstatIdList.add(tstatId); } } return tstatIdList; }
From source file:com.ecofactor.qa.automation.newapp.page.impl.LocationSwitcherUIPageImpl.java
License:Open Source License
/** * Gets the rangeof temperature.//from w w w. j av a 2 s. c om * @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
/** * Click the submit button./*from www.ja va 2s .com*/ * @param userName the user name. * @see com.ecofactor.qa.automation.newapp.page.LoginPage#clickSubmit(java.lang.String) */ @Override public void clickSubmit(String userName) { LogUtil.setLogString("Click Login Button", true, CustomLogLevel.LOW); final WebElement loginBtn = getElement(getDriver(), By.className(LOGIN_SUBMIT), TINY_TIMEOUT); getAction().click(loginBtn); WaitUtil.tinyWait(); // getAction().rejectAlert(); String currentUTCTime = DateUtil.getUTCCurrentTimeStamp(); LogUtil.setLogString("\033[46;1mLOGIN REQUEST - UTC TIME: " + currentUTCTime + "\033[0m", true, CustomLogLevel.LOW); setLoginStartTime(new LocalTime()); setLoggedIn(isLoadingIconNotDisplayed()); setLoggedInUser(userName); currentUTCTime = DateUtil.getUTCCurrentTimeStamp(); LogUtil.setLogString(LogSection.END, "Login " + (isLoggedIn() ? "Succeeded" : "Failed"), true); }
From source file:com.ecofactor.qa.automation.newapp.page.impl.LoginPageImpl.java
License:Open Source License
/** * Click login./* w w w .ja v a 2 s . co m*/ * @param userName the user name * @param password the password * @see com.ecofactor.qa.automation.newapp.page.LoginPage#clickLogin(java.lang.String) */ public void clickLogin(String userName, String password) { LogUtil.setLogString("Enter Username :" + userName, true); clearAndInput(getDriver(), By.name(USERNAME), userName); LogUtil.setLogString("Enter Password :" + password, true); clearAndInput(getDriver(), By.name(PASSWORD), password); LogUtil.setLogString("Click Login", true); final WebElement loginBtn = getElement(getDriver(), By.className(LOGIN_SUBMIT), TINY_TIMEOUT); getAction().click(loginBtn); WaitUtil.oneSec(); getAction().rejectAlert(); setLoggedIn(isLoadingIconNotDisplayed()); setLoggedInUser(userName); }
From source file:com.ecofactor.qa.automation.newapp.page.impl.LoginPageImpl.java
License:Open Source License
/** * Checks if is not login page.//from w ww.j a va2s.co m * @return true, if is not login page */ private boolean isNotLoginPage() { return isNotDisplayed(getDriver(), By.name(USERNAME), TINY_TIMEOUT) && isNotDisplayed(getDriver(), By.name(PASSWORD), TINY_TIMEOUT) && isNotDisplayed(getDriver(), By.className(LOGIN_SUBMIT), TINY_TIMEOUT); }
From source file:com.ecofactor.qa.automation.newapp.page.impl.LoginPageImpl.java
License:Open Source License
/** * Checks if is page loaded./* w w w.j av a 2s . c o m*/ * @return true, if is page loaded * @see com.ecofactor.qa.automation.mobile.page.BasePage#isPageLoaded() */ @Override public boolean isPageLoaded() { LogUtil.setLogString("Verify the Login Page is loaded", true, CustomLogLevel.MEDIUM); waitForPageLoaded(getDriver()); isLoadingIconNotDisplayed(); return isDisplayed(getDriver(), By.className(LOGIN_SUBMIT), TINY_TIMEOUT); }