List of usage examples for org.openqa.selenium WebElement clear
void clear();
From source file:com.ecofactor.qa.automation.insite.page.UserManagementImpl.java
License:Open Source License
/** * Edits the mobile phone number./*from w w w . j a va 2 s .c om*/ * @param mobilePhoneNumber the mobile phone number * @see com.ecofactor.qa.automation.insite.page.UserManagement#editMobilePhoneNumber(java.lang.String) */ @Override public void editMobilePhoneNumber(final String mobilePhoneNumber) { DriverConfig.setLogString("Edit mobilePhoneNumber", true); if (mobilePhoneNumber != null && !mobilePhoneNumber.isEmpty()) { final WebElement emailElemt = DriverConfig.getDriver().findElement(By.id(userConfig.get(MOBILE_NUM))); emailElemt.clear(); DriverConfig.setLogString("Enter mobilePhoneNumber: " + mobilePhoneNumber, true); emailElemt.sendKeys(mobilePhoneNumber); } }
From source file:com.ecofactor.qa.automation.insite.page.UserManagementImpl.java
License:Open Source License
/** * Edits the home phone number.//from ww w .java2 s . c o m * @param homePhoneNumber the home phone number * @see com.ecofactor.qa.automation.insite.page.UserManagement#editHomePhoneNumber(java.lang.String) */ @Override public void editHomePhoneNumber(final String homePhoneNumber) { DriverConfig.setLogString("Edit homePhoneNumber", true); if (homePhoneNumber != null && !homePhoneNumber.isEmpty()) { final WebElement emailElemt = DriverConfig.getDriver().findElement(By.id(userConfig.get(PHONE_NUM))); emailElemt.clear(); DriverConfig.setLogString("Enter homePhoneNumber: " + homePhoneNumber, true); emailElemt.sendKeys(homePhoneNumber); } }
From source file:com.ecofactor.qa.automation.insite.page.UserManagementImpl.java
License:Open Source License
/** * Edits the fax./*from w w w . jav a 2s .c o 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.MobileTest.java
License:Open Source License
/** * Do login./* w ww.ja v a 2 s . c om*/ * @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.SettingsPageImpl.java
License:Open Source License
/** * Change thermostat name.// w w w.j a va2 s . 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./*from www . j a v a2 s . c o m*/ * @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() *///from w w w .ja v a2 s . 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 w w w.j a va 2 s . com*/ * @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.util.PageUtil.java
License:Open Source License
/** * Sets the value./* ww w .java 2 s .co m*/ * @param driver the driver * @param cssSelector the css selector * @param value the value */ public static void setValueByCSS(WebDriver driver, String cssSelector, String value) { if (isDisplayedByCSS(driver, cssSelector, 10)) { List<WebElement> inputs = driver.findElements(By.cssSelector(cssSelector)); for (WebElement input : inputs) { if (input.isDisplayed() && input.isEnabled()) { input.clear(); input.sendKeys(value); } } } }
From source file:com.ecofactor.qa.automation.util.PageUtil.java
License:Open Source License
/** * Sets the value./* w ww. ja v a 2 s. co m*/ * @param driver the driver * @param cssSelector the css selector * @param value the value * @param index the index */ public static void setValueByCSS(WebDriver driver, String cssSelector, String value, int index) { if (isDisplayedByCSS(driver, cssSelector, 10)) { List<WebElement> inputs = driver.findElements(By.cssSelector(cssSelector)); int count = 0; for (WebElement input : inputs) { if (input.isDisplayed() && input.isEnabled()) { if (count == index) { input.clear(); input.sendKeys(value); logger.info("Count " + count + ", " + input.getAttribute("id")); break; } ++count; } } } }