List of usage examples for org.openqa.selenium Keys DELETE
Keys DELETE
To view the source code for org.openqa.selenium Keys DELETE.
Click Source Link
From source file:com.liferay.faces.test.FACES1427PortletTest.java
License:Open Source License
@Test @RunAsClient/*from w w w. j av a2 s .c o m*/ @InSequence(1300) public void steps89012() throws Exception { if (isThere(browser, errorMessageXpath) && errorMessage.isDisplayed()) { return; } logger.log(Level.INFO, "8: textarea1.getAttribute('value') = " + textarea1.getAttribute("value")); // click into textarea1 textarea1.click(); Thread.sleep(50); // move to the beginning of textarea1 textarea1.sendKeys(Keys.HOME); // firefox cursor is on the left after the last click, in chromium cursor is on // the right of the text ... grr Thread.sleep(50); // arrow over to the word 'initial' textarea1.sendKeys(Keys.ARROW_RIGHT); Thread.sleep(50); textarea1.sendKeys(Keys.ARROW_RIGHT); Thread.sleep(50); textarea1.sendKeys(Keys.ARROW_RIGHT); Thread.sleep(50); textarea1.sendKeys(Keys.ARROW_RIGHT); Thread.sleep(50); textarea1.sendKeys(Keys.ARROW_RIGHT); Thread.sleep(50); textarea1.sendKeys(Keys.ARROW_RIGHT); Thread.sleep(50); textarea1.sendKeys(Keys.ARROW_RIGHT); Thread.sleep(50); textarea1.sendKeys(Keys.ARROW_RIGHT); Thread.sleep(50); textarea1.sendKeys(Keys.ARROW_RIGHT); Thread.sleep(50); textarea1.sendKeys(Keys.ARROW_RIGHT); Thread.sleep(50); // delete the word 'initial' textarea1.sendKeys(Keys.DELETE); Thread.sleep(50); textarea1.sendKeys(Keys.DELETE); Thread.sleep(50); textarea1.sendKeys(Keys.DELETE); Thread.sleep(50); textarea1.sendKeys(Keys.DELETE); Thread.sleep(50); textarea1.sendKeys(Keys.DELETE); Thread.sleep(50); textarea1.sendKeys(Keys.DELETE); Thread.sleep(50); textarea1.sendKeys(Keys.DELETE); Thread.sleep(50); // type the word 'subsequent' textarea1.sendKeys("subsequent"); Thread.sleep(50); // select the word 'subsequent' ... easier said than done logger.log(Level.INFO, "8: textarea1.getAttribute('id') = '" + textarea1.getAttribute("id") + "'"); logger.log(Level.INFO, "8: before selecting ... selectText.getSelection(id) = " + selectText.getSelection(textarea1.getAttribute("id"))); Thread.sleep(500); logger.log(Level.INFO, "8: selectText.getSelection('id', 10, 20) ... "); selectText.setSelection(textarea1.getAttribute("id"), 10, 20); Thread.sleep(1000); logger.log(Level.INFO, "8: after selecting ... selectText.getSelection(id) = " + selectText.getSelection(textarea1.getAttribute("id"))); Thread.sleep(500); logger.log(Level.INFO, "8: isThere(browser, bold1Xpath) = " + isThere(browser, bold1Xpath)); logger.log(Level.INFO, "8: bold1.isDisplayed() = " + bold1.isDisplayed()); logger.log(Level.INFO, "8: bold1.getAttribute('src') = " + bold1.getAttribute("src")); logger.log(Level.INFO, "8: bold1.getLocation() = " + bold1.getLocation()); logger.log(Level.INFO, "8: clicking the bold1 button ..."); // click the bold1 button to make the word 'subsequent' bold try { bold1.click(); } catch (Exception e) { // apparently things are different in chromium logger.log(Level.INFO, "8: e.getMessage() = " + e.getMessage()); (new Actions(browser)).moveToElement(bold1, 3, 3).click(bold1).build().perform(); Thread.sleep(500); (new Actions(browser)).moveToElement(bold1, 3, 3).click().build().perform(); Thread.sleep(500); (new Actions(browser)).moveToElement(bold1).doubleClick().build().perform(); Thread.sleep(500); } Thread.sleep(50); // move into iframe1 logger.log(Level.INFO, "9: clicking into iframe1 ..."); iframe1.click(); Thread.sleep(50); (new Actions(browser)).sendKeys(Keys.TAB).perform(); Thread.sleep(50); // arrow over to the word 'initial' (new Actions(browser)).sendKeys(Keys.ARROW_RIGHT).perform(); Thread.sleep(50); (new Actions(browser)).sendKeys(Keys.ARROW_RIGHT).perform(); Thread.sleep(50); (new Actions(browser)).sendKeys(Keys.ARROW_RIGHT).perform(); Thread.sleep(50); (new Actions(browser)).sendKeys(Keys.ARROW_RIGHT).perform(); Thread.sleep(50); (new Actions(browser)).sendKeys(Keys.ARROW_RIGHT).perform(); Thread.sleep(50); (new Actions(browser)).sendKeys(Keys.ARROW_RIGHT).perform(); Thread.sleep(50); (new Actions(browser)).sendKeys(Keys.ARROW_RIGHT).perform(); Thread.sleep(50); (new Actions(browser)).sendKeys(Keys.ARROW_RIGHT).perform(); Thread.sleep(50); (new Actions(browser)).sendKeys(Keys.ARROW_RIGHT).perform(); Thread.sleep(50); (new Actions(browser)).sendKeys(Keys.ARROW_RIGHT).perform(); Thread.sleep(50); (new Actions(browser)).sendKeys(Keys.ARROW_RIGHT).perform(); Thread.sleep(50); (new Actions(browser)).sendKeys(Keys.ARROW_RIGHT).perform(); Thread.sleep(50); (new Actions(browser)).sendKeys(Keys.ARROW_RIGHT).perform(); Thread.sleep(50); (new Actions(browser)).sendKeys(Keys.ARROW_RIGHT).perform(); Thread.sleep(50); (new Actions(browser)).sendKeys(Keys.ARROW_RIGHT).perform(); Thread.sleep(50); (new Actions(browser)).sendKeys(Keys.ARROW_RIGHT).perform(); Thread.sleep(50); (new Actions(browser)).sendKeys(Keys.ARROW_RIGHT).perform(); Thread.sleep(50); // delete the word 'initial' (new Actions(browser)).sendKeys(Keys.BACK_SPACE).perform(); Thread.sleep(50); (new Actions(browser)).sendKeys(Keys.BACK_SPACE).perform(); Thread.sleep(50); (new Actions(browser)).sendKeys(Keys.BACK_SPACE).perform(); Thread.sleep(50); (new Actions(browser)).sendKeys(Keys.BACK_SPACE).perform(); Thread.sleep(50); (new Actions(browser)).sendKeys(Keys.BACK_SPACE).perform(); Thread.sleep(50); (new Actions(browser)).sendKeys(Keys.BACK_SPACE).perform(); Thread.sleep(50); (new Actions(browser)).sendKeys(Keys.BACK_SPACE).perform(); Thread.sleep(50); // type the word 'subsequent' (new Actions(browser)).sendKeys("subsequent").perform(); Thread.sleep(50); // select the word 'subsequent' ... easier said than done (new Actions(browser)).keyDown(iframe1, Keys.SHIFT).sendKeys(Keys.LEFT).sendKeys(Keys.LEFT) .sendKeys(Keys.LEFT).sendKeys(Keys.LEFT).sendKeys(Keys.LEFT).sendKeys(Keys.LEFT).sendKeys(Keys.LEFT) .sendKeys(Keys.LEFT).sendKeys(Keys.LEFT).sendKeys(Keys.LEFT).keyUp(iframe1, Keys.SHIFT).build() .perform(); Thread.sleep(50); // click the bold2 button to make the word 'subsequent' bold logger.log(Level.INFO, "9: clicking on the bold button in the second editor ..."); bold2.click(); Thread.sleep(50); // Why do we need to click the iframe before clicking the submit button? Who knows? iframe1.click(); Thread.sleep(50); // submit the form logger.log(Level.INFO, "10: clicking the submit button ..."); submit.click(); Thread.sleep(50); // log some elements logger.log(Level.INFO, "11: comments1Output.getText() = " + comments1Output.getText()); logger.log(Level.INFO, "12: comments2Output.getText() = " + comments2Output.getText()); // assert to test assertTrue( "the submitted value for the FIRST editor should be 'comments1-[b]subsequent[/b]-value', but " + "it is '" + comments1Output.getText() + "'", comments1Output.getText().equals("comments1-[b]subsequent[/b]-value")); assertTrue( "the submitted value for the SECOND editor should be 'comments2-[b]subsequent[/b]-value', but " + "it is '" + comments2Output.getText() + "'", comments2Output.getText().equals("comments2-[b]subsequent[/b]-value")); }
From source file:com.qkn.automation.pages.LoginPage.java
public void loginWithValidCredentialsForAndroidQKN(String email, String password) throws Exception { try {//from w w w . ja va2s. co m WebDriverWait wait = new WebDriverWait(pageDriver, 30); // pageDriver.findElement(By.name(pageprops.getProperty("SINGUP_BUTTON_LOGINPAGE"))) // .click(); findElementByXpathAndClick(pageDriver, pageprops.getProperty("SINGUP_BUTTON_LOGINPAGE")); // pageDriver.findElement(By.xpath(pageprops.getProperty("SINGUP_BUTTON_LOGINPAGE"))).click(); // Thread.sleep(TestConstants.MINSLEEPTIME); //applitools to test sign in page // eyes.checkWindow("Sign in page"); // wait.until( ExpectedConditions.visibilityOfElementLocated(By.id(pageprops.getProperty("LOGIN_USERNAME")))); pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_USERNAME"))).sendKeys(Keys.CONTROL + "a"); pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_USERNAME"))).sendKeys(Keys.DELETE); System.out.println("Before send keys for username"); pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_USERNAME"))).sendKeys(email); pageDriver.findElement(By.xpath(pageprops.getProperty("LOGIN_PWD2"))).sendKeys(Keys.CONTROL + "a"); pageDriver.findElement(By.xpath(pageprops.getProperty("LOGIN_PWD2"))).sendKeys(Keys.DELETE); // Thread.sleep(3000); System.out.println("Before sendkeys for password"); pageDriver.findElement(By.xpath(pageprops.getProperty("LOGIN_PWD2"))).sendKeys(password); // Thread.sleep(5000); //Require this to run on local to hide the keyboard not required on sauce labs . // pageDriver.navigate().back(); /*JavascriptExecutor js = (JavascriptExecutor) pageDriver; HashMap flickObject = new HashMap(); flickObject.put("endX", 0); flickObject.put("endY", 0); flickObject.put("touchCount", 1); js.executeScript("mobile: swipe", flickObject);*/ // Added by ashwini // eyes.checkWindow("Sign in Page"); findElementByXpathAndClick(pageDriver, pageprops.getProperty("SIGNIN_BTN")); // pageDriver.findElement(By.xpath(pageprops.getProperty("SIGNIN_BTN"))).click(); /*JavascriptExecutor jse = (JavascriptExecutor) pageDriver; jse.executeScript("UIATarget.localTarget().frontMostApp().keyboard().buttons()['Go'].tap();"); */ // Thread.sleep(20000); // Thread.sleep(15000); /*wait.until(ExpectedConditions.visibilityOfElementLocated(By .name(pageprops .getProperty("OK_BTN"))));*/ // if(pageDriver.findElements(By.xpath("//android.widget.FrameLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.Button[1]")).size()!=0) // { // MintLogger.log(Level.INFO,"Welcome to quicken screen displayed So click on OK button"); // // } wait.until( ExpectedConditions.visibilityOfElementLocated(By.xpath(pageprops.getProperty("SIGNINOK_BTN")))); findElementByXpathAndClick(pageDriver, pageprops.getProperty("SIGNINOK_BTN")); QuickenLogger.log(Level.INFO, "Login successfull with " + email + " as username and " + password + " as password"); // if (pageDriver.getPageSource().contains("OK")) { //// pageDriver.findElement(By.name("OK")).click(); // pageDriver.findElement(By.xpath("//android.widget.FrameLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.Button[1]")).click(); // System.out.println("Login successfull with "+email+" as username and "+password+" as password"); // } Thread.sleep(TestConstants.MINSLEEPTIME); /* if (tabname.equalsIgnoreCase("OVERVIEW")){ pageDriver.findElement(By.name(pageprops.getProperty("OVERVIEW_TAB"))) .click(); } else if(tabname.equalsIgnoreCase("UPDATES")){ pageDriver.findElement(By.name(pageprops.getProperty("UPDATES_TAB"))) .click(); }*/ } //added catch (Exception e) { MintLogger.log(Level.INFO, "Unable to Sign in "); e.printStackTrace(); } }
From source file:com.qkn.automation.pages.LoginPage.java
public void loginWithInValidCredentials(String email, String password) throws Exception { QuickenLogger.log(Level.INFO, "loginWithInValidCredentials"); WebDriverWait wait = new WebDriverWait(pageDriver, 30); pageDriver.findElement(By.name(pageprops.getProperty("SINGUP_BUTTON_LOGINPAGE"))).click(); Thread.sleep(20000);// w ww. jav a 2 s .c om wait.until(ExpectedConditions.visibilityOfElementLocated(By.id(pageprops.getProperty("LOGIN_USERNAME")))); pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_USERNAME"))).sendKeys(Keys.CONTROL + "a"); pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_USERNAME"))).sendKeys(Keys.DELETE); System.out.println("Before send keys for username"); pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_USERNAME"))).sendKeys(email); pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_PWD"))).sendKeys(Keys.CONTROL + "a"); pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_PWD"))).sendKeys(Keys.DELETE); // Thread.sleep(3000); System.out.println("Before sendkeys for password"); pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_PWD"))).sendKeys(password); Thread.sleep(5000); pageDriver.navigate().back(); pageDriver.findElement(By.xpath(pageprops.getProperty("SIGNIN_BTN"))).click(); }
From source file:com.qkn.automation.pages.LoginPage.java
public void loginViaGetStarted(String email, String password) throws Exception { MintLogger.log(Level.INFO, "loginWithInValidCredentials"); WebDriverWait wait = new WebDriverWait(pageDriver, 30); pageDriver.findElement(By.name("Get started")).click(); Thread.sleep(4000);/*from www . ja v a2 s . com*/ /*JavascriptExecutor js = (JavascriptExecutor) pageDriver; HashMap flickObject = new HashMap(); flickObject.put("endX", 0); flickObject.put("endY", 0); flickObject.put("touchCount", 1); js.executeScript("mobile: swipe", flickObject); Thread.sleep(4000); */ pageDriver.findElement(By.name(pageprops.getProperty("SINGUP_BUTTON_GETSTARTEDPAGE"))).click(); wait.until(ExpectedConditions.visibilityOfElementLocated(By.id(pageprops.getProperty("LOGIN_USERNAME")))); pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_USERNAME"))).sendKeys(Keys.CONTROL + "a"); pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_USERNAME"))).sendKeys(Keys.DELETE); System.out.println("Before send keys for username"); pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_USERNAME"))).sendKeys(email); pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_PWD"))).sendKeys(Keys.CONTROL + "a"); pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_PWD"))).sendKeys(Keys.DELETE); // Thread.sleep(3000); System.out.println("Before sendkeys for password"); pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_PWD"))).sendKeys(password); Thread.sleep(3000); pageDriver.navigate().back(); Thread.sleep(1000); pageDriver.findElement(By.xpath(pageprops.getProperty("SIGNIN_BTN"))).click(); /* JavascriptExecutor jse = (JavascriptExecutor) pageDriver; jse.executeScript("UIATarget.localTarget().frontMostApp().keyboard().buttons()['Go'].tap();"); */ Thread.sleep(15000); wait.until(ExpectedConditions.visibilityOfElementLocated(By.name(pageprops.getProperty("OK_BTN")))); if (pageDriver.getPageSource().contains("OK")) { pageDriver.findElement(By.name("OK")).click(); } Thread.sleep(13000); }
From source file:com.qkn.automation.pages.LoginPage.java
public void loginWithValidCredentialsForAndroidQKN2(String email, String password) throws Exception { try {//from www. jav a 2s . c o m WebDriverWait wait = new WebDriverWait(pageDriver, 30); findElementByXpathAndClick(pageDriver, pageprops.getProperty("SINGUP_BUTTON_LOGINPAGE")); wait.until( ExpectedConditions.visibilityOfElementLocated(By.id(pageprops.getProperty("LOGIN_USERNAME")))); pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_USERNAME"))).sendKeys(Keys.CONTROL + "a"); pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_USERNAME"))).sendKeys(Keys.DELETE); System.out.println("Before send keys for username"); pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_USERNAME"))).sendKeys(email); pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_PWD"))).sendKeys(Keys.CONTROL + "a"); pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_PWD"))).sendKeys(Keys.DELETE); System.out.println("Before sendkeys for password"); pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_PWD"))).sendKeys(password); findElementByXpathAndClick(pageDriver, pageprops.getProperty("SIGNIN_BTN")); wait.until( ExpectedConditions.visibilityOfElementLocated(By.xpath(pageprops.getProperty("SIGNINOK_BTN")))); findElementByXpathAndClick(pageDriver, pageprops.getProperty("SIGNINOK_BTN")); QuickenLogger.log(Level.INFO, "Login successfull with " + email + " as username and " + password + " as password"); Thread.sleep(TestConstants.MINSLEEPTIME); } //added catch (Exception e) { MintLogger.log(Level.INFO, "Unable to Sign in "); e.printStackTrace(); } }
From source file:com.seleniumtests.uipage.htmlelements.DatePickerElement.java
License:Apache License
/** * Clear text field but assumes element exists *//*from w w w . ja va 2 s . co m*/ private void clearField() { if (element == null) { throw new ScenarioException("Element should not be null"); } BrowserType browser = WebUIDriver.getWebUIDriver(false).getConfig().getBrowser(); if (browser == BrowserType.INTERNET_EXPLORER) { new Actions(driver).doubleClick(element) .sendKeys(Keys.DELETE, Keys.DELETE, Keys.DELETE, Keys.DELETE, Keys.DELETE, Keys.DELETE, Keys.DELETE, Keys.DELETE, Keys.DELETE, Keys.DELETE) .sendKeys(Keys.BACK_SPACE, Keys.BACK_SPACE, Keys.BACK_SPACE, Keys.BACK_SPACE, Keys.BACK_SPACE, Keys.BACK_SPACE, Keys.BACK_SPACE, Keys.BACK_SPACE, Keys.BACK_SPACE, Keys.BACK_SPACE) .perform(); } else { super.clear(); } }
From source file:com.thoughtworks.selenium.webdriven.commands.SendKeys.java
License:Apache License
@Override protected Void handleSeleneseCommand(WebDriver driver, String locator, String value) { alertOverride.replaceAlertMethod(driver); value = value.replace("${KEY_ALT}", Keys.ALT); value = value.replace("${KEY_CONTROL}", Keys.CONTROL); value = value.replace("${KEY_CTRL}", Keys.CONTROL); value = value.replace("${KEY_META}", Keys.META); value = value.replace("${KEY_COMMAND}", Keys.COMMAND); value = value.replace("${KEY_SHIFT}", Keys.SHIFT); value = value.replace("${KEY_BACKSPACE}", Keys.BACK_SPACE); value = value.replace("${KEY_BKSP}", Keys.BACK_SPACE); value = value.replace("${KEY_DELETE}", Keys.DELETE); value = value.replace("${KEY_DEL}", Keys.DELETE); value = value.replace("${KEY_ENTER}", Keys.ENTER); value = value.replace("${KEY_EQUALS}", Keys.EQUALS); value = value.replace("${KEY_ESCAPE}", Keys.ESCAPE); value = value.replace("${KEY_ESC}", Keys.ESCAPE); value = value.replace("${KEY_INSERT}", Keys.INSERT); value = value.replace("${KEY_INS}", Keys.INSERT); value = value.replace("${KEY_PAUSE}", Keys.PAUSE); value = value.replace("${KEY_SEMICOLON}", Keys.SEMICOLON); value = value.replace("${KEY_SPACE}", Keys.SPACE); value = value.replace("${KEY_TAB}", Keys.TAB); value = value.replace("${KEY_LEFT}", Keys.LEFT); value = value.replace("${KEY_UP}", Keys.UP); value = value.replace("${KEY_RIGHT}", Keys.RIGHT); value = value.replace("${KEY_DOWN}", Keys.DOWN); value = value.replace("${KEY_PAGE_UP}", Keys.PAGE_UP); value = value.replace("${KEY_PGUP}", Keys.PAGE_UP); value = value.replace("${KEY_PAGE_DOWN}", Keys.PAGE_DOWN); value = value.replace("${KEY_PGDN}", Keys.PAGE_DOWN); value = value.replace("${KEY_END}", Keys.END); value = value.replace("${KEY_HOME}", Keys.HOME); value = value.replace("${KEY_NUMPAD0}", Keys.NUMPAD0); value = value.replace("${KEY_N0}", Keys.NUMPAD0); value = value.replace("${KEY_NUMPAD1}", Keys.NUMPAD1); value = value.replace("${KEY_N1}", Keys.NUMPAD1); value = value.replace("${KEY_NUMPAD2}", Keys.NUMPAD2); value = value.replace("${KEY_N2}", Keys.NUMPAD2); value = value.replace("${KEY_NUMPAD3}", Keys.NUMPAD3); value = value.replace("${KEY_N3}", Keys.NUMPAD3); value = value.replace("${KEY_NUMPAD4}", Keys.NUMPAD4); value = value.replace("${KEY_N4}", Keys.NUMPAD4); value = value.replace("${KEY_NUMPAD5}", Keys.NUMPAD5); value = value.replace("${KEY_N5}", Keys.NUMPAD5); value = value.replace("${KEY_NUMPAD6}", Keys.NUMPAD6); value = value.replace("${KEY_N6}", Keys.NUMPAD6); value = value.replace("${KEY_NUMPAD7}", Keys.NUMPAD7); value = value.replace("${KEY_N7}", Keys.NUMPAD7); value = value.replace("${KEY_NUMPAD8}", Keys.NUMPAD8); value = value.replace("${KEY_N8}", Keys.NUMPAD8); value = value.replace("${KEY_NUMPAD9}", Keys.NUMPAD9); value = value.replace("${KEY_N9}", Keys.NUMPAD9); value = value.replace("${KEY_ADD}", Keys.ADD); value = value.replace("${KEY_NUM_PLUS}", Keys.ADD); value = value.replace("${KEY_DECIMAL}", Keys.DECIMAL); value = value.replace("${KEY_NUM_PERIOD}", Keys.DECIMAL); value = value.replace("${KEY_DIVIDE}", Keys.DIVIDE); value = value.replace("${KEY_NUM_DIVISION}", Keys.DIVIDE); value = value.replace("${KEY_MULTIPLY}", Keys.MULTIPLY); value = value.replace("${KEY_NUM_MULTIPLY}", Keys.MULTIPLY); value = value.replace("${KEY_SEPARATOR}", Keys.SEPARATOR); value = value.replace("${KEY_SEP}", Keys.SEPARATOR); value = value.replace("${KEY_SUBTRACT}", Keys.SUBTRACT); value = value.replace("${KEY_NUM_MINUS}", Keys.SUBTRACT); value = value.replace("${KEY_F1}", Keys.F1); value = value.replace("${KEY_F2}", Keys.F2); value = value.replace("${KEY_F3}", Keys.F3); value = value.replace("${KEY_F4}", Keys.F4); value = value.replace("${KEY_F5}", Keys.F5); value = value.replace("${KEY_F6}", Keys.F6); value = value.replace("${KEY_F7}", Keys.F7); value = value.replace("${KEY_F8}", Keys.F8); value = value.replace("${KEY_F9}", Keys.F9); value = value.replace("${KEY_F10}", Keys.F10); value = value.replace("${KEY_F11}", Keys.F11); value = value.replace("${KEY_F12}", Keys.F12); finder.findElement(driver, locator).sendKeys(value); return null;//from w ww . jav a 2 s . c om }
From source file:com.vaadin.demo.registration.RegistrationFormIT.java
License:Apache License
@Test public void validateConfirmPasswd_empty() { PasswordFieldElement password = $(PasswordFieldElement.class).get(0); password.sendKeys("aa11bbss33ddd"); password.sendKeys(Keys.TAB);/*from w ww . ja va2 s.co m*/ password = $(PasswordFieldElement.class).get(1); password.sendKeys(Keys.DELETE); password.sendKeys(Keys.TAB); Assert.assertEquals(1, findElements(By.className("validation-message")).size()); List<WebElement> icons = findElements(By.className("v-icon")); Assert.assertEquals(VALID_ICON_CHAR, icons.get(0).getText().charAt(0)); }
From source file:demo.seleniumtest.DemoTest.java
@Test public void test2() { //Write 2002 in the filter text and verify that we only see two rows final int expectedTableSizeTwo = 2; final int expectedTableSizeFive = 5; new WebDriverWait(driver, waitTime).until(new Function<WebDriver, Object>() { public Boolean apply(WebDriver wd) { wd.findElement(By.id("filter")); return true; }//w ww . j a va2 s .com }); driver.findElement(By.id("filter")).sendKeys("2002"); int actualTableSizeTwo = driver.findElement(By.id("tbodycars")).findElements(By.tagName("tr")).size(); driver.findElement(By.id("filter")).sendKeys(Keys.CONTROL + "a"); driver.findElement(By.id("filter")).sendKeys(Keys.DELETE); int actualTableSizeFive = driver.findElement(By.id("tbodycars")).findElements(By.tagName("tr")).size(); assertThat(actualTableSizeTwo, is(expectedTableSizeTwo)); assertThat(actualTableSizeFive, is(expectedTableSizeFive)); }
From source file:objective.taskboard.it.MainPage.java
License:Open Source License
public MainPage typeSearch(String searchValue) { searchIssuesInput.sendKeys(Keys.CONTROL, "a"); searchIssuesInput.sendKeys(Keys.DELETE); searchIssuesInput.sendKeys(searchValue); waitUntil(textToBePresentInElementValue(searchIssuesInput, searchValue)); return this; }