List of usage examples for org.openqa.selenium By cssSelector
public static By cssSelector(String cssSelector)
From source file:com.easytox.automation.steps.AuditAndUserLogImpl.java
@When("^In User Log click on up arrow icon on (.*)$") public void in_user_log_click_on_up_arrow_icon(String column) { if (column.equals("Case Acc#")) { driver.findElement(By.cssSelector(SORT_ASCENDING_LOCATOR)).sendKeys(Keys.ENTER); } else {// ww w .j a va2 s . c o m MyWebDriverUtils.waitContainerThenClick(driver, SORT_ASCENDING_LOCATOR, LocatorType.CSS); } }
From source file:com.easytox.automation.steps.LabClientImpl.java
@Then("^Lab client is updated successfully$") public void lab_client_is_updated_successfully() { WebElement el = driver.findElement(By.cssSelector(MESSAGE_LOCATOR)); Assert.assertTrue(el.isDisplayed()); WebElement el1 = MyWebDriverUtils.findPresenceElement(driver, SUCCESS_LOCATOR, LocatorType.CSS); if (el1 != null) { String elValue = el1.getText(); Assert.assertEquals(elValue, SUCCESS_VALUE); } else {//from ww w . j a va 2 s . com Assert.fail("el is false!"); } }
From source file:com.easytox.automation.steps.LabClientImpl.java
@When("^Enter User information, Personal information and select lab information. click on 'Submit'$") public void enter_information_and_submit() throws InterruptedException { Thread.sleep(TIME_STOP);// ww w .j a v a 2s. co m WebElement userName = MyWebDriverUtils.findElement(driver, USER_USERNAME_LOCATOR, LocatorType.NAME); if (userName != null) { userNameValue = StringUtils.generateRandom(); userName.clear(); userName.sendKeys(userNameValue); } else { Assert.fail("userName is null!"); } WebElement password = MyWebDriverUtils.findElement(driver, USER_PASSWORD_LOCATOR, LocatorType.NAME); if (password != null) { password.clear(); password.sendKeys(USER_PASSWORD_VALUE); } else { Assert.fail("password is null!"); } WebElement firstName = MyWebDriverUtils.findElement(driver, USER_FIRST_NAME_LOCATOR, LocatorType.CSS); if (firstName != null) { firstName.clear(); firstName.sendKeys(USER_FIRST_NAME_VALUE); } else { Assert.fail("firstName is null!"); } WebElement lastName = MyWebDriverUtils.findElement(driver, USER_LAST_NAME_LOCATOR, LocatorType.CSS); if (lastName != null) { lastName.clear(); lastName.sendKeys(USER_LAST_NAME_VALUE); } else { Assert.fail("lastName is null!"); } WebElement email = MyWebDriverUtils.findElement(driver, USER_EMAIL_LOCATOR, LocatorType.NAME); if (email != null) { email.clear(); email.sendKeys(USER_EMAIL_VALUE); } else { Assert.fail("email is null!"); } WebElement phoneNumber = MyWebDriverUtils.findElement(driver, USER_PHONE_NUMBER_LOCATOR, LocatorType.NAME); if (phoneNumber != null) { phoneNumber.clear(); phoneNumber.sendKeys(USER_PHONE_NUMBER_VALUE); } else { Assert.fail("phoneNumber is null!"); } new Select(driver.findElement(By.cssSelector(SELECT_ROLE_LOCATOR))).selectByVisibleText(ROLE); new Select(driver.findElement(By.id(LAB_LOCATIONS_LOCATOR))).selectByVisibleText(LAB_LOCATIONS_VALUE); WebElement el = MyWebDriverUtils.findElement(driver, USER_SUBMIT_LOCATOR, LocatorType.CSS); WebDriverWait wait = new WebDriverWait(driver, TIME_OUT_IN_SECONDS); boolean flag = MyWebDriverUtils.waitInvisibilityOfElement(wait, CONTAINER_LOCATOR, LocatorType.ID); if (flag) { checkAndClick(el); } else { Assert.fail("flag is false!"); } }
From source file:com.easytox.automation.steps.LabClientImpl.java
@Then("^Account locked message should be populated and user should not be able to login to application$") public void account_locked_message_should_be_populated() { String currentUrl = driver.getCurrentUrl(); Assert.assertEquals(currentUrl, LOGIN_PAGE_URL); WebElement element = driver.findElement(By.name(FIND_USERNAME)); element.clear();/*from w w w . ja v a 2 s .c om*/ element.sendKeys(LOCK_USER); WebElement el = driver.findElement(By.name(FIND_LOGIN)); el.clear(); el.sendKeys(PASSWORD); driver.findElement(By.xpath(LOGIN_BUTTON_XPATH)).click(); WebElement message = driver.findElement(By.cssSelector(LOCKED_MESSAGE_LOCATOR)); Assert.assertTrue(message.isDisplayed()); }
From source file:com.ecfeed.core.runner.java.SeleniumTestMethodInvoker.java
License:Open Source License
private WebElement findWebElementBy(String findByType, String findByValue) { checkWebDriver();//from w w w .j a v a2s .c o m if (NodePropertyDefFindByType.isId(findByType)) { return fDriver.findElement(By.id(findByValue)); } if (NodePropertyDefFindByType.isClassName(findByType)) { return fDriver.findElement(By.className(findByValue)); } if (NodePropertyDefFindByType.isTagName(findByType)) { return fDriver.findElement(By.tagName(findByValue)); } if (NodePropertyDefFindByType.isTagName(findByType)) { return fDriver.findElement(By.tagName(findByValue)); } if (NodePropertyDefFindByType.isName(findByType)) { return fDriver.findElement(By.name(findByValue)); } if (NodePropertyDefFindByType.isLinkText(findByType)) { return fDriver.findElement(By.linkText(findByValue)); } if (NodePropertyDefFindByType.isPartialLinkText(findByType)) { return fDriver.findElement(By.partialLinkText(findByValue)); } if (NodePropertyDefFindByType.isCssSelector(findByType)) { return fDriver.findElement(By.cssSelector(findByValue)); } if (NodePropertyDefFindByType.isXPath(findByType)) { return fDriver.findElement(By.xpath(findByValue)); } return null; }
From source file:com.ecofactor.qa.automation.insite.page.InsiteInstallationPageImpl.java
License:Open Source License
/** * Click top first user./*from w w w .j a v a2 s. c o m*/ * * @see com.ecofactor.qa.automation.insite.page.InsiteInstallationPage#clickTopFirstUser() */ @Override public void clickTopFirstUser() { DriverConfig.setLogString("Click top first user.", true); mediumWait(); final WebElement theRecord = DriverConfig.getDriver().findElement(By.cssSelector(".userinfo>a")); theRecord.click(); }
From source file:com.ecofactor.qa.automation.insite.page.InsiteInstallationPageImpl.java
License:Open Source License
/** * Checks if is installation tab displayed. * //from w ww .java2 s. c om * @return true, if is installation tab displayed * @see com.ecofactor.qa.automation.insite.page.InsiteInstallationPage#isInstallationTabDisplayed() */ @Override public boolean isInstallationTabDisplayed() { DriverConfig.setLogString("Verify installation Page Displayed.", true); mediumWait(); final WebElement installLink = DriverConfig.getDriver().findElement(By.cssSelector(MENU_NAME)); return installLink.getText().equalsIgnoreCase(INSTALLATION); }
From source file:com.ecofactor.qa.automation.insite.page.InsiteLoginImpl.java
License:Open Source License
/** * Click reset password link./* www .j a v a 2 s . co m*/ */ public void clickResetPasswordLink() { if (DriverConfig.getDriver() == null) { getDriver(); } if (isAuthenticatedUser()) { logger.info("User Login exists, need to logout."); logout(); } DriverConfig.getDriver().get(appConfig.get(INSITE_URL)); smallWait(); logger.info("check if reset password link visible and click it.", true); isDisplayedByCSS(DriverConfig.getDriver(), loginConfig.get(RESET_PASSWORD_LINK), MEDIUM_TIMEOUT); DriverConfig.setLogString("click reset password link.", true); DriverConfig.getDriver().findElement(By.cssSelector(loginConfig.get(RESET_PASSWORD_LINK))).click(); smallWait(); }
From source file:com.ecofactor.qa.automation.insite.page.InsiteLoginImpl.java
License:Open Source License
/** * Test reset pswd cancel link./*from www .j a va 2 s .co m*/ * @see com.ecofactor.qa.automation.insite.page.InsiteLogin#testResetPswdCancelLink() */ @Override public void testResetPswdCancelLink() { clickResetPasswordLink(); logger.info("check if cancel button available in reset password wizard."); isDisplayedByCSS(DriverConfig.getDriver(), loginConfig.get(CANCEL_RESET_PASSWORD), MEDIUM_TIMEOUT); DriverConfig.setLogString("click cancel button in reset password.", true); DriverConfig.getDriver().findElement(By.cssSelector(loginConfig.get(CANCEL_RESET_PASSWORD))).click(); smallWait(); isDisplayedByCSS(DriverConfig.getDriver(), loginConfig.get(RESET_PASSWORD_LINK), MEDIUM_TIMEOUT); DriverConfig.setLogString("check if login page is displayed.", true); logger.info("check if reset password wizard is displayed."); Assert.assertTrue( isDisplayedByCSS(DriverConfig.getDriver(), loginConfig.get(RESET_PASSWORD_LINK), MEDIUM_TIMEOUT), "Reset password link is not available"); }
From source file:com.ecofactor.qa.automation.insite.page.InsiteLoginImpl.java
License:Open Source License
/** * Test about ecofactor link./*w ww . j av a 2 s . co m*/ * @see com.ecofactor.qa.automation.insite.page.InsiteLogin#testAboutEcofactorLink() */ @Override public void testAboutEcofactorLink() { if (DriverConfig.getDriver() == null) { getDriver(); } if (isAuthenticatedUser()) { logger.info("User Login exists, need to logout."); logout(); } DriverConfig.setLogString("Load insite URL.", true); loadPageWithoutAssertion(); logger.info("check if 'About Ecofactor' link is available & click it.", true); DriverConfig.setLogString("click 'About Ecofactor' link.", true); DriverConfig.getDriver().findElement(By.cssSelector(insiteConfig.get(ABOUT_ECOFACTOR_LINK))).click(); smallWait(); logger.info("check if 'About Ecofactor' page is displayed.", true); Assert.assertTrue( DriverConfig.getDriver().getCurrentUrl().equalsIgnoreCase(insiteConfig.get(ECOFACTOR_URL)), "Url is different"); }