List of usage examples for org.openqa.selenium WebElement sendKeys
void sendKeys(CharSequence... keysToSend);
From source file:com.ecofactor.qa.automation.insite.page.UserManagementImpl.java
License:Open Source License
/** * Edits the fax./* ww w . j a v a 2 s .co m*/ * @param fax the fax * @see com.ecofactor.qa.automation.insite.page.UserManagement#editFax(java.lang.String) */ @Override public void editFax(final String fax) { DriverConfig.setLogString("Edit fax", true); if (fax != null && !fax.isEmpty()) { final WebElement emailElemt = DriverConfig.getDriver().findElement(By.id(userConfig.get(FAX_NUM))); emailElemt.clear(); DriverConfig.setLogString("Enter fax: " + fax, true); emailElemt.sendKeys(fax); } }
From source file:com.ecofactor.qa.automation.newapp.admin.page.impl.AdminHomePageImpl.java
License:Open Source License
/** * Filter criteria.// ww w . j a v a2s. c om * @param criteriaString the criteria string * @see com.ecofactor.qa.automation.newapp.admin.page.AdminHomePage#filterCriteria(java.lang.String) */ public void filterCriteria(String criteriaString) { isPageLoaded(); setLogString("Enter criteria to filter." + criteriaString, true); isDisplayed(driverManager.getAdminDriver(), By.name(CRITERIA), SHORT_TIMEOUT); final WebElement criteriaText = getElement(driverManager.getAdminDriver(), By.name(CRITERIA), TINY_TIMEOUT); criteriaText.sendKeys(criteriaString); final WebElement searchbutton = getElementBySubElementAttr(driverManager.getAdminDriver(), formElement, By.tagName(TAG_INPUT), ATTR_VALUE, SEARCH, SHORT_TIMEOUT); searchbutton.click(); smallWait(); }
From source file:com.ecofactor.qa.automation.newapp.MobileTest.java
License:Open Source License
/** * Do login./* ww w. jav a 2s .c o m*/ * @param userName the user name * @param password the password * @throws Exception the exception */ private void doLogin(String userName, String password) throws Exception { DriverConfig.setLogString("Login to Consumer Portal with username: " + userName, true); mediumWait(); mobileOps.switchToWebView(); DriverConfig.setLogString("Check Username textField is displayed", true); WebElement el = mobileOps.getDeviceDriver().findElement(By.id("j_username")); el.clear(); el.sendKeys(userName); smallWait(); DriverConfig.setLogString("Check Password field is displayed", true); WebElement el2 = mobileOps.getDeviceDriver().findElement(By.id("j_password")); el2.clear(); el2.sendKeys(password); mediumWait(); DriverConfig.setLogString("Click Login Submit Button", true); WebElement el3 = mobileOps.getDeviceDriver().findElement(By.id("loginSubmit")); mobileUIAction.click(el3); mediumWait(); }
From source file:com.ecofactor.qa.automation.newapp.page.impl.LoginPageImpl.java
License:Open Source License
/** * Entering the userName and password in fields. * @param userName the user name//www.ja v a2s. c om * @param password the password * @see com.ecofactor.qa.automation.newapp.page.LoginPage#userNamePasswordFields(java.lang.String, * java.lang.String) */ @Override public void userNamePasswordFields(String userName, String password) { getAction().rejectAlert(); LogUtil.setLogString(LogSection.START, "Login Starts", true); LogUtil.setLogString("Check Username textField is displayed", true, CustomLogLevel.HIGH); WebElement userElement = getElement(getDriver(), By.name(USERNAME), TINY_TIMEOUT); WaitUtil.waitUntil(300); userElement.sendKeys(userName); // clearAndInput(getDriver(), By.name(USERNAME), userName); LogUtil.setLogString("Enter Username :" + userName, true, CustomLogLevel.LOW); LogUtil.setLogString("Check Password field is displayed", true, CustomLogLevel.HIGH); clearAndInput(getDriver(), By.name(PASSWORD), password); LogUtil.setLogString("Enter Password :" + password, true, CustomLogLevel.LOW); }
From source file:com.ecofactor.qa.automation.newapp.page.impl.SettingsPageImpl.java
License:Open Source License
/** * Change thermostat name.// w w w.j av a2s . co m * @see com.ecofactor.qa.automation.newapp.page.SettingsPage#changeThermostatName() */ @Override public void changeThermostatName() { setLogString("Click Thermostat name Field", true, CustomLogLevel.LOW); final WebElement thermostatField = getElement(getDriver(), By.cssSelector(THERMOSTAT_FIELD), TINY_TIMEOUT); getAction().click(thermostatField); WaitUtil.oneSec(); getAction().rejectAlert(); setLogString("Thermostat Field Name Changed.", true, CustomLogLevel.LOW); WaitUtil.oneSec(); final WebElement fieldValue = getElement(getDriver(), By.cssSelector(THERMOSTAT_FIELD_VALUE), TINY_TIMEOUT); fieldValue.clear(); WaitUtil.oneSec(); fieldValue.sendKeys(THERMOSTAT_FIELD_NAME); WaitUtil.fourSec(); setLogString("Updated Thermostat Field Name.", true, CustomLogLevel.LOW); final WebElement thermostatFieldName = getElement(getDriver(), By.cssSelector(INSTALLED_THERMOSTAT), TINY_TIMEOUT); getAction().click(thermostatFieldName); getAction().rejectAlert(); tinyWait(); clickMenuHighlighted(); }
From source file:com.ecofactor.qa.automation.newapp.page.impl.SettingsPageImpl.java
License:Open Source License
/** * Change sixty char tst name.// www . jav a 2s . com * @see com.ecofactor.qa.automation.newapp.page.SettingsPage#changeSixtyCharTstName() */ @Override public void changeSixtyCharTstName() { setLogString("Click Thermostat name Field", true, CustomLogLevel.LOW); final WebElement thermostatField = getElement(getDriver(), By.cssSelector(THERMOSTAT_FIELD), TINY_TIMEOUT); getAction().click(thermostatField); WaitUtil.oneSec(); getAction().rejectAlert(); setLogString("Thermostat Field Name Changed.", true, CustomLogLevel.LOW); WaitUtil.oneSec(); final WebElement fieldValue = getElement(getDriver(), By.cssSelector(THERMOSTAT_FIELD_VALUE), TINY_TIMEOUT); fieldValue.clear(); WaitUtil.oneSec(); fieldValue.sendKeys(TST_NAME_SIXTY_CHAR); WaitUtil.fourSec(); setLogString("Updated Thermostat Field Name.", true, CustomLogLevel.LOW); getToastErrorMessage(); final WebElement thermostatFieldName = getElement(getDriver(), By.cssSelector(INSTALLED_THERMOSTAT), TINY_TIMEOUT); getAction().click(thermostatFieldName); getAction().rejectAlert(); tinyWait(); clickMenuHighlighted(); }
From source file:com.ecofactor.qa.automation.newapp.page.impl.ThermostatPageOpsImpl.java
License:Open Source License
/** * All kind of settings operation can perform here. * @see com.ecofactor.qa.automation.newapp.page.ThermostatPageOps#settingsOperations() */// w w w . j a va 2s. c o m @Override public void settingsOperations() { setLogString("Click Thermostat name Field", true, CustomLogLevel.LOW); final WebElement thermostatField = getElement(getDriver(), By.cssSelector(THERMOSTAT_FIELD), TINY_TIMEOUT); getAction().click(thermostatField); WaitUtil.oneSec(); getAction().rejectAlert(); setLogString("Thermostat Field Name Changed.", true, CustomLogLevel.LOW); WaitUtil.oneSec(); final WebElement fieldValue = getElement(getDriver(), By.cssSelector(THERMOSTAT_FIELD_VALUE), TINY_TIMEOUT); fieldValue.clear(); WaitUtil.oneSec(); fieldValue.sendKeys(THERMOSTAT_FIELD_NAME); WaitUtil.fourSec(); setLogString("Updated Thermostat Field Name.", true, CustomLogLevel.LOW); final WebElement thermostatFieldName = getElement(getDriver(), By.cssSelector(INSTALLED_THERMOSTAT), TINY_TIMEOUT); getAction().click(thermostatFieldName); getAction().rejectAlert(); tinyWait(); clickSettingsMenu(); }
From source file:com.ecofactor.qa.automation.platform.util.Pageutil.java
License:Open Source License
/** * Clear the web element data and input new field value * @param driver the driver//from www . j a v a 2 s . co m * @param locator the locator * @param fieldValue the field value */ public static void clearAndInput(final WebDriver driver, final By locator, final String fieldValue) { final WebElement element = getElement(driver, locator, SHORT_TIMEOUT); element.clear(); element.sendKeys(fieldValue); }
From source file:com.ecofactor.qa.automation.qtc.page.QTCLoginImpl.java
License:Open Source License
/** * Enter login./* w w w . j a v a 2s. c om*/ * @param userName the user name * @param password the password * @see com.ecofactor.qa.automation.qtc.page.QTCLogin#enterLogin(java.lang.String, * java.lang.String) */ @Override public void enterLogin(String userName, String password) { largeWait(); //boolean qtcPage = isDisplayedByClassName(DriverConfig.getDriver(), loginConfig.get(USER_NAME), SHORT_TIMEOUT); //assertTrue(qtcPage, "Page is not loading"); WebElement userField = DriverConfig.getDriver().findElement(By.name(loginConfig.get(USER_NAME))); WebElement passwordField = DriverConfig.getDriver().findElement(By.name(loginConfig.get(PASSWORD))); assertNotNull(userField); assertNotNull(passwordField); DriverConfig.setLogString("Enter username and password", true); userField.sendKeys(userName); passwordField.sendKeys(password); }
From source file:com.ecofactor.qa.automation.util.mail.OutlookMail.java
License:Open Source License
/** * Gets the changed password.//from w ww .j av a 2 s. co m * @param driver the driver * @param url the url * @param emailUserName the email user name * @param emailPassword the email password * @param subject the subject * @param boldIndex the bold index * @return the changed password */ public String getChangedPassword(String url, String emailUserName, String emailPassword, String subject, int boldIndex) { WebDriver driver = driverConfig.getDriver(); DriverConfig.setLogString("Load Email portal URL.", true); driver.navigate().to(url); largeWait(); DriverConfig.setLogString("Enter Username/Password for Email.", true); driver.findElement(By.id("cred_userid_inputtext")).sendKeys(emailUserName); driver.findElement(By.id("cred_password_inputtext")).sendKeys(emailPassword); smallWait(); DriverConfig.setLogString("Click Login.", true); WebElement signInButtonElement = driver.findElement(By.cssSelector("#cred_sign_in_button")); DriverConfig.setLogString("send keys to login", true); signInButtonElement.sendKeys(Keys.RETURN); largeWait(); DriverConfig.setLogString("click btn", true); signInButtonElement.click(); largeWait(); DriverConfig.setLogString("Click Inbox.", true); WebElement outLookMenu = retrieveElementByTagText(driver, TAG_SPAN, "Outlook"); if (outLookMenu != null && outLookMenu.isDisplayed()) { outLookMenu.click(); mediumWait(); } DriverConfig.setLogString("Click Subject of Email.", true); List<WebElement> subElements = retrieveElementsByTagText(driver, TAG_SPAN, subject); if (subElements.size() > 0) { subElements.get(0).click(); mediumWait(); } largeWait(); DriverConfig.setLogString("Get temporary Password from Email.", true); WebElement divBodyElement = driver.findElement(By.id("Item.MessagePartBody")); mediumWait(); WebElement pwdElement = divBodyElement.findElements(By.tagName(TAG_BOLD)).get(boldIndex); String tempPassword = pwdElement.getText(); DriverConfig.setLogString("Temporary password got from email " + tempPassword, true); DriverConfig.setLogString("Click user for Signout option", true); WebElement menuElement = retrieveElementByAttributeValue(driver, TAG_BUTTON, ATTR_CLASS, "button _hl_2 _hl_e"); menuElement.click(); smallWait(); DriverConfig.setLogString("Click Signout", true); WebElement signOut = retrieveElementByTagText(driver, TAG_SPAN, "sign out", MEDIUM_TIMEOUT); signOut.click(); smallWait(); return tempPassword; }