List of usage examples for org.openqa.selenium Keys BACK_SPACE
Keys BACK_SPACE
To view the source code for org.openqa.selenium Keys BACK_SPACE.
Click Source Link
From source file:org.tomitribe.tribestream.registryng.functionaltests.pages.ApplicationDetailsPage.java
License:Apache License
public void enterApplicationName(final String newTitle) throws IOException { titleField.click();//w w w .j av a 2s . c o m waitGui(); WebElement textField = titleField.findElement(By.cssSelector("input[type='text']")); // No Ctrl+A because on Mac it's probably COMMAND+A textField.sendKeys(Keys.chord(Keys.CONTROL, "a"), Keys.BACK_SPACE); textField.sendKeys(newTitle); guardNoRequest(checkButton).click(); }
From source file:org.tomitribe.tribestream.registryng.functionaltests.pages.ApplicationDetailsPage.java
License:Apache License
public void enterVersion(final String newVersion) throws IOException { versionField.click();//from w w w . j ava 2 s. c om waitGui(); WebElement textField = versionField.findElement(By.cssSelector("input[type='text']")); textField.sendKeys(Keys.chord(Keys.CONTROL, "a"), Keys.BACK_SPACE); textField.sendKeys(newVersion); guardNoRequest(checkButton).click(); }
From source file:org.tomitribe.tribestream.registryng.functionaltests.pages.ApplicationDetailsPage.java
License:Apache License
public void enterDescription(final String newDescription) throws Exception { // TODO: No idea how to edit the markdown component. SeleniumIDE does not see any actions as well... :-( // assertTrue(descriptionField.isDisplayed()); // Actions actions = new Actions(driver).moveToElement(descriptionField); // createScreenshot("target/aftermove.png"); // actions.click(); // createScreenshot("target/afterclick.png"); descriptionField.click();/*from w w w .j av a 2 s .co m*/ Thread.sleep(5000); guardNoRequest(descriptionEditor).sendKeys(Keys.chord(Keys.CONTROL, "a"), Keys.BACK_SPACE, newDescription); guardNoRequest(checkButton).click(); }
From source file:org.tomitribe.tribestream.registryng.functionaltests.pages.EndpointDetailsPage.java
License:Apache License
public void enterVerb(final String newVerb) throws Exception { WebElement textField = verbSingleSelect.findElement(By.cssSelector("input[type='text']")); verbSingleSelect.click();/*from w ww. j a v a 2 s. com*/ Thread.sleep(5000); guardNoRequest(textField).sendKeys(Keys.chord(Keys.CONTROL, "a"), Keys.BACK_SPACE, newVerb, Keys.ENTER); }
From source file:org.tomitribe.tribestream.registryng.functionaltests.pages.EndpointDetailsPage.java
License:Apache License
public void enterPath(final String newPath) throws IOException { pathTextField.click();//from w w w. j a v a2 s .c om waitGui(); WebElement textField = pathTextField.findElement(By.cssSelector("input[type='text']")); textField.sendKeys(Keys.chord(Keys.CONTROL, "a"), Keys.BACK_SPACE); textField.sendKeys(newPath); guardNoRequest(checkButton).click(); }
From source file:org.tomitribe.tribestream.registryng.webapp.EditApplicationPage.java
License:Apache License
public void enterName(final WebDriver driver, final String newTitle) { titleField.click();/*w ww . j av a 2 s. com*/ new WebDriverWait(driver, 5000).until((Function<WebDriver, Boolean>) (dontcare -> titleField .findElement(By.cssSelector("input[type='text']")).isDisplayed())); WebElement textField = titleField.findElement(By.cssSelector("input[type='text']")); textField.sendKeys(Keys.END); System.out.println("TEXT: " + textField.getText()); while (textField.getText().length() > 0) { textField.sendKeys(Keys.BACK_SPACE); System.out.println("TEXT: " + textField.getText()); } textField.sendKeys(newTitle, "\n"); }
From source file:org.xwiki.flamingo.test.po.EditThemePage.java
License:Open Source License
public void setVariableValue(String variableName, String value) { WebElement variableField = getDriver() .findElement(By.xpath("//label[text() = '@" + variableName + "']/..//input")); // Remove the previous value variableField.sendKeys(Keys.chord(Keys.CONTROL, "a"), Keys.BACK_SPACE); // Write the one variableField.sendKeys(value);// ww w . ja va 2s . co m }
From source file:org.xwiki.test.ui.appwithinminutes.ApplicationNameTest.java
License:Open Source License
/** * Try to create an application with an empty name using the next step button. *///from w ww . j a va 2 s . c o m @Test @IgnoreBrowsers({ @IgnoreBrowser(value = "internet.*", version = "8\\.*", reason = "See http://jira.xwiki.org/browse/XE-1146"), @IgnoreBrowser(value = "internet.*", version = "9\\.*", reason = "See http://jira.xwiki.org/browse/XE-1177") }) public void testEmptyAppNameWithNextStepButton() { ApplicationCreatePage appCreatePage = ApplicationCreatePage.gotoPage(); Assert.assertFalse(appCreatePage.getContent().contains(EMPTY_APP_NAME_ERROR_MESSAGE)); // Try to move to the next step without typing the application name. String urlBeforeClick = getDriver().getCurrentUrl(); appCreatePage.clickNextStepButton(); Assert.assertEquals(urlBeforeClick, getDriver().getCurrentUrl()); // Type the application name. appCreatePage.setApplicationName("A"); appCreatePage.waitForApplicationNamePreview(); Assert.assertFalse(appCreatePage.getContent().contains(EMPTY_APP_NAME_ERROR_MESSAGE)); // Clear the application name using the Backspace key. appCreatePage.getApplicationNameInput().sendKeys(Keys.BACK_SPACE); appCreatePage.waitForApplicationNameError(); Assert.assertTrue(appCreatePage.getContent().contains(EMPTY_APP_NAME_ERROR_MESSAGE)); // Try to create the application even if the error message is displayed. urlBeforeClick = getDriver().getCurrentUrl(); appCreatePage.clickNextStepButton(); Assert.assertEquals(urlBeforeClick, getDriver().getCurrentUrl()); // Fix the application name and move to the next step. appCreatePage.setApplicationName(getTestMethodName()); appCreatePage.waitForApplicationNamePreview(); Assert.assertEquals("Class: " + getTestMethodName(), appCreatePage.clickNextStep().getDocumentTitle()); }
From source file:org.xwiki.test.ui.appwithinminutes.ApplicationNameTest.java
License:Open Source License
/** * Try to create an application with an empty name using the Enter key. *//*from w ww.j a v a 2 s.com*/ @Test @IgnoreBrowsers({ @IgnoreBrowser(value = "internet.*", version = "8\\.*", reason = "See http://jira.xwiki.org/browse/XE-1146"), @IgnoreBrowser(value = "internet.*", version = "9\\.*", reason = "See http://jira.xwiki.org/browse/XE-1177") }) public void testEmptyAppNameWithEnter() { ApplicationCreatePage appCreatePage = ApplicationCreatePage.gotoPage(); Assert.assertFalse(appCreatePage.getContent().contains(EMPTY_APP_NAME_ERROR_MESSAGE)); // Press Enter key without typing the application name. appCreatePage.getApplicationNameInput().sendKeys(Keys.RETURN); appCreatePage.waitForApplicationNameError(); Assert.assertTrue(appCreatePage.getContent().contains(EMPTY_APP_NAME_ERROR_MESSAGE)); // Type the application name. appCreatePage.setApplicationName("B"); appCreatePage.waitForApplicationNamePreview(); Assert.assertFalse(appCreatePage.getContent().contains(EMPTY_APP_NAME_ERROR_MESSAGE)); // Clear the application name using the Backspace key. appCreatePage.getApplicationNameInput().sendKeys(Keys.BACK_SPACE); appCreatePage.waitForApplicationNameError(); Assert.assertTrue(appCreatePage.getContent().contains(EMPTY_APP_NAME_ERROR_MESSAGE)); // Try to create the application even if the error message is displayed. appCreatePage.getApplicationNameInput().sendKeys(Keys.RETURN); Assert.assertTrue(appCreatePage.getContent().contains(EMPTY_APP_NAME_ERROR_MESSAGE)); // Fix the application name and move to the next step using the Enter key. appCreatePage.setApplicationName(getTestMethodName()); appCreatePage.waitForApplicationNamePreview(); appCreatePage.getApplicationNameInput().sendKeys(Keys.RETURN); Assert.assertEquals("Class: " + getTestMethodName(), new ViewPage().getDocumentTitle()); }
From source file:org.xwiki.test.ui.appwithinminutes.UserClassFieldTest.java
License:Open Source License
@Test public void testSuggestions() { UserPicker userPicker = new UserClassFieldEditPane(editor.addField("User").getName()).getUserPicker(); // The suggestions should be case-insensitive. Match the last name. List<UserElement> suggestions = userPicker.sendKeys("mOr").waitForSuggestions().getSuggestions(); Assert.assertEquals(2, suggestions.size()); assertUserElement(suggestions.get(0), "Eduard Moraru", "Enygma2002"); assertUserElement(suggestions.get(1), "Thomas Mortagne"); // Match the first name. suggestions = userPicker.sendKeys(Keys.BACK_SPACE, Keys.BACK_SPACE, "As").waitForSuggestions() .getSuggestions();/* w ww . ja v a 2 s . c o m*/ Assert.assertEquals(1, suggestions.size()); assertUserElement(suggestions.get(0), "Thomas Mortagne"); // Match the alias. suggestions = userPicker.sendKeys(Keys.BACK_SPACE, "20").waitForSuggestions().getSuggestions(); Assert.assertEquals(1, suggestions.size()); assertUserElement(suggestions.get(0), "Eduard Moraru", "Enygma2002"); // The guest user shouldn't be suggested. suggestions = userPicker.clear().sendKeys("guest").waitForSuggestions().getSuggestions(); Assert.assertEquals(1, suggestions.size()); Assert.assertEquals("User not found", suggestions.get(0).getText()); // Default administrator user should be suggested. suggestions = userPicker.clear().sendKeys("admin").waitForSuggestions().getSuggestions(); Assert.assertEquals(1, suggestions.size()); assertUserElement(suggestions.get(0), "Administrator", "Admin", "noavatar.png"); // "a" should bring many suggestions. Also, a single letter should bring suggestions. Assert.assertTrue(userPicker.clear().sendKeys("a").waitForSuggestions().getSuggestions().size() > 2); // An empty text input shouldn't bring any suggestions. try { userPicker.sendKeys(Keys.BACK_SPACE).waitForSuggestions(); Assert.fail(); } catch (Exception e) { } // We should be able to close the list of suggestions using the escape key. userPicker.sendKeys("mor").waitForSuggestions().sendKeys(Keys.ESCAPE).waitForSuggestionsToFadeOut(); // The list of suggestions should close itself after a while. userPicker.moveMouseOver().sendKeys(Keys.BACK_SPACE).waitForSuggestions().waitForSuggestionsToDisappear(); // The list of suggestions should stay open if the mouse is over it. userPicker.sendKeys(Keys.BACK_SPACE).waitForSuggestions().getSuggestions().get(0).moveMouseOver(); try { userPicker.waitForSuggestionsToDisappear(); Assert.fail(); } catch (Exception e) { } // .. and the list of suggestions should fade out when the mouse is moved out. userPicker.moveMouseOver().waitForSuggestionsToFadeOut(); }