List of usage examples for org.openqa.selenium By cssSelector
public static By cssSelector(String cssSelector)
From source file:com.ecofactor.qa.automation.insite.page.InsitePageImpl.java
License:Open Source License
@Override public void clickAboutEcofactor() { logger.info("check if About Ecofactor link displayed.", true); WebElement aboutEcofactorLink = DriverConfig.getDriver() .findElement(By.cssSelector(insiteConfig.get(ABOUT_ECOFACTOR_LINK))); DriverConfig.setLogString("Click About Ecofactor", true); aboutEcofactorLink.click();/*ww w. j a v a 2 s .c o m*/ }
From source file:com.ecofactor.qa.automation.insite.page.InstallationHardwareImpl.java
License:Open Source License
@Override public String removeThermostat() { smallWait();/* www .ja va 2 s .c om*/ WebElement getAddressDiv = retrieveElementByAttributeValue(DriverConfig.getDriver(), TAG_DIV, ATTR_ID, "getAddressDiv"); logger.info("remove getAddressDiv ID: " + getAddressDiv.getAttribute("id"), true); WebElement tblHomeProfile = retrieveElementByAttributeValue(DriverConfig.getDriver(), TAG_TABLE, ATTR_ID, "homeProfile"); logger.info("remove tblHomeProfile: " + tblHomeProfile.getAttribute("class"), true); //get thermostat name , which will be removed. List<WebElement> tagTDElements = retrieveElementsByContainsOfAttributeValue(DriverConfig.getDriver(), TAG_TD, ATTR_CLASS, "ef_dataTable toCountThermostats"); WebElement tstatTDElement = tagTDElements.get(tagTDElements.size() - 1); WebElement lastThermostatNameElement = retrieveElementByAttributeValueByPassingElement( DriverConfig.getDriver(), tstatTDElement, TAG_INPUT, ATTR_TYPE, "text"); String thermostatName = lastThermostatNameElement.getAttribute("value"); DriverConfig.setLogString("Thermostat to be removed: " + thermostatName, true); //select tstat to remove DriverConfig.setLogString("Select thermostat to remove.", true); smallWait(); //WebElement selectTstatCheckBox=retrieveElementByAttributeValue(DriverConfig.getDriver(), TAG_INPUT, ATTR_TYPE, "checkbox", LONG_TIMEOUT); WebElement selectTstatCheckBox = DriverConfig.getDriver() .findElement(By.cssSelector(installationConfig.get(CHECKBOX))); selectTstatCheckBox.click(); logger.info("CheckBox: " + selectTstatCheckBox.getAttribute("type"), true); //click remove link DriverConfig.setLogString("Click remove link.", true); WebElement removeThermostatLink = retrieveElementByAttributeValueByPassingElement(DriverConfig.getDriver(), getAddressDiv, TAG_ANCHOR, ATTR_ID, "delThermostat"); logger.info("Remove Link id: " + removeThermostatLink.getAttribute("id"), true); removeThermostatLink.click(); smallWait(); return thermostatName; }
From source file:com.ecofactor.qa.automation.insite.page.PartnerManagementImpl.java
License:Open Source License
/** * Click Next./*from w ww. ja v a 2 s.co m*/ * @see com.ecofactor.qa.automation.insite.page.PartnerManagement#clickNext() */ @Override public void clickNext() { LogUtil.setLogString("click Next", true); WaitUtil.smallWait(); final WebElement nextLink = DriverConfig.getDriver().findElement(By.cssSelector("a.next.ef_smallLabel")); nextLink.click(); }
From source file:com.ecofactor.qa.automation.insite.page.PartnerManagementImpl.java
License:Open Source License
/** * Click previous./*from www . ja v a 2s . c o m*/ * @see com.ecofactor.qa.automation.insite.page.PartnerManagement#clickPrevious() */ @Override public void clickPrevious() { LogUtil.setLogString("click Previous", true); WaitUtil.smallWait(); final WebElement previousLink = DriverConfig.getDriver() .findElement(By.cssSelector("a.prev.ef_smallLabel")); previousLink.click(); }
From source file:com.ecofactor.qa.automation.insite.page.PartnerManagementImpl.java
License:Open Source License
/** * Click First./*from w ww . jav a 2 s . c o m*/ * @see com.ecofactor.qa.automation.insite.page.PartnerManagement#clickFirst() */ @Override public void clickFirst() { LogUtil.setLogString("click First", true); WaitUtil.smallWait(); final WebElement firstLink = DriverConfig.getDriver().findElement(By.cssSelector("a.first.ef_smallLabel")); firstLink.click(); }
From source file:com.ecofactor.qa.automation.insite.page.PartnerManagementImpl.java
License:Open Source License
/** * Click Last.//from w w w.j av a 2 s .c o m * @see com.ecofactor.qa.automation.insite.page.PartnerManagement#clickLast() */ @Override public void clickLast() { LogUtil.setLogString("click Last", true); WaitUtil.smallWait(); final WebElement lastLink = DriverConfig.getDriver().findElement(By.cssSelector("a.last.ef_smallLabel")); lastLink.click(); }
From source file:com.ecofactor.qa.automation.insite.page.SupportLookUpImpl.java
License:Open Source License
/** * Do verify pswd reset by new app login. * @param userName the user name/* www. j av a 2s. co m*/ * @param tempPassword the temp password * @param newPassword the new password * @param newAppUrl the new app url * @see com.ecofactor.qa.automation.insite.page.SupportLookUp#doVerifyPswdResetByNewAppLogin(java.lang.String, * java.lang.String, java.lang.String, java.lang.String) */ @Override public void doVerifyPswdResetByNewAppLogin(String userName, String tempPassword, String newPassword, String newAppUrl) { /* * WebDriver popup = null; Set<String> windowids = * DriverConfig.getDriver().getWindowHandles(); Iterator<String> iter = * windowids.iterator(); iter.next(); * DriverConfig.setLogString("Switch to other window and verify the title", true); popup = * DriverConfig.getDriver().switchTo().window((String) iter.next()); smallWait(); iter = * windowids.iterator(); if (iter.hasNext()) { checkConsumerNewPasswordTrigger(userName, * tempPassword); doConsumerChangePassword(tempPassword, newPassword); doConsumerlogout(); * loginConsumerPortal(userName, newPassword); doConsumerlogout(); popup.close(); // switch * to main window DriverConfig.setLogString("Switch to main window", true); * DriverConfig.getDriver().switchTo().window((String) iter.next()); } */ DriverConfig.setLogString("Load URL : " + newAppUrl, true); DriverConfig.getDriver().get(newAppUrl); mediumWait(); DriverConfig.setLogString("Enter UserName and Password", true); clearAndInput(DriverConfig.getDriver(), By.name("username"), userName); clearAndInput(DriverConfig.getDriver(), By.name("password"), tempPassword); tinyWait(); DriverConfig.setLogString("Click Login", true); DriverConfig.getDriver().findElement(By.className("login_submit")).click(); largeWait(); DriverConfig.setLogString("Enter temporary Password : " + tempPassword, true); clearAndInput(DriverConfig.getDriver(), By.className("input_old_password"), tempPassword); tinyWait(); DriverConfig.setLogString("Enter New Password : " + newPassword, true); clearAndInput(DriverConfig.getDriver(), By.className("input_new_password"), newPassword); tinyWait(); DriverConfig.setLogString("Re-Enter New Password : " + newPassword, true); clearAndInput(DriverConfig.getDriver(), By.className("input_confirm_new_password"), newPassword); tinyWait(); DriverConfig.setLogString("Click Continue", true); DriverConfig.getDriver().findElement(By.className("continueButton")).click(); smallWait(); DriverConfig.setLogString("Check HelpOverlay Page displayed", true); isDisplayedByClassName(DriverConfig.getDriver(), "help_slide", SHORT_TIMEOUT); while (!isDisplayedByClassName(DriverConfig.getDriver(), "close_ftux_button", SHORT_TIMEOUT)) { DriverConfig.setLogString("Click Next.", true); DriverConfig.getDriver().findElement(By.className("slick-next")).click(); } DriverConfig.setLogString("Click GetStarted", true); DriverConfig.getDriver().findElement(By.className("close_ftux_button")).click(); tinyWait(); DriverConfig.setLogString("Click Logout", true); DriverConfig.getDriver().findElement(By.cssSelector("div.menu_row.logout")).click(); assertTrue(isDisplayedByClassName(DriverConfig.getDriver(), "login_submit", SHORT_TIMEOUT), "Login Page Not Loaded Successfully"); }
From source file:com.ecofactor.qa.automation.insite.page.SupportLookUpImpl.java
License:Open Source License
/** * Verify consumer login./*w w w . j a va 2s . 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); }
From source file:com.ecofactor.qa.automation.insite.page.SupportLookUpImpl.java
License:Open Source License
/** * Do consumerlogout.// w ww. ja v a 2 s . com */ public void doConsumerlogout() { DriverConfig.setLogString("Click Logout link.", true); WebElement logoutLink = DriverConfig.getDriver() .findElement(By.cssSelector(loginConfig.get(CONSUMER_LOGOUT_LINK))); logoutLink.click(); DriverConfig.setLogString("Check Login Page", true); boolean logoDisplayed = isDisplayedByCSS(DriverConfig.getDriver(), loginConfig.get(CONSUMER_LOGIN_LOGO), MEDIUM_TIMEOUT); assertTrue(logoDisplayed, "logo is not displayed"); }
From source file:com.ecofactor.qa.automation.insite.page.UserManagementImpl.java
License:Open Source License
/** * Gets the current page no./*from w ww. j a va 2s . co m*/ * @return the current page no * @see com.ecofactor.qa.automation.insite.page.UserManagement#getCurrentPageNo() */ @Override public int getCurrentPageNo() { WebElement element = DriverConfig.getDriver() .findElement(By.cssSelector("input.pagedisplay.ef_smallLabel.ieFix")); String pageNo = element.getAttribute(ATTR_VALUE).split(" ")[0]; DriverConfig.setLogString("Current Page No : " + pageNo, true); return Integer.valueOf(pageNo); }