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:org.xwiki.test.ui.KeyboardShortcutsTest.java
License:Open Source License
@Test public void testKeyboardShortcuts() { ViewPage vp = util.gotoPage("Sandbox", "WebHome"); // Test default edit mode (WYSIWYG for sandbox webhome) key vp.sendKeys("e"); vp.waitUntilPageIsLoaded();/*from w w w.j ava2s.com*/ Assert.assertTrue(util.isInWYSIWYGEditMode()); // Test Cancel key vp.sendKeys(Keys.ALT, "c"); vp.waitUntilPageIsLoaded(); Assert.assertTrue(util.isInViewMode()); // Test Wiki edit key vp.sendKeys("k"); vp.waitUntilPageIsLoaded(); Assert.assertTrue(util.isInWikiEditMode()); // Test WYSIWYG edit mode key vp = this.util.gotoPage("Sandbox", "WebHome"); vp.sendKeys("e"); vp.waitUntilPageIsLoaded(); Assert.assertTrue(util.isInWYSIWYGEditMode()); // Test Inline edit mode key vp = this.util.gotoPage("Sandbox", "WebHome"); vp.sendKeys("f"); vp.waitUntilPageIsLoaded(); Assert.assertTrue(util.isInInlineEditMode()); // Test Rights edit mode key vp = this.util.gotoPage("Sandbox", "WebHome"); vp.sendKeys("r"); vp.waitUntilPageIsLoaded(); Assert.assertTrue(util.isInRightsEditMode()); // Test Object edit mode key vp = this.util.gotoPage("Sandbox", "WebHome"); vp.sendKeys("o"); vp.waitUntilPageIsLoaded(); Assert.assertTrue(util.isInObjectEditMode()); // Test Class edit mode key vp = this.util.gotoPage("Sandbox", "WebHome"); vp.sendKeys("s"); vp.waitUntilPageIsLoaded(); Assert.assertTrue(util.isInClassEditMode()); // Test Delete key vp = this.util.gotoPage("Sandbox", "WebHome"); vp.sendKeys(Keys.DELETE); Assert.assertTrue(util.isInDeleteMode()); // Test Rename key vp = this.util.gotoPage("Sandbox", "WebHome"); vp.sendKeys(Keys.F2); Assert.assertTrue(util.isInRenameMode()); }
From source file:org.xwiki.test.wysiwyg.framework.AbstractWysiwygTestCase.java
License:Open Source License
public void typeDelete(int count, boolean hold) { sendKey(Keys.DELETE, count, hold); }
From source file:org.zanata.page.AbstractPage.java
License:Open Source License
/** * Enter text into an element.// www. j a v a2 s . c o m * * Waits for notifications to be dismissed and element to be ready and visible before entering * the text. * If no checking is performed, the resulting screenshot may not be accurate. * @param element element to pass text to * @param text text to be entered * @param clear clear the element's text before entering new text * @param inject use sendKeys rather than the Actions chain (direct injection) * @param check check the 'value' attribute for success, and accurate screenshot delay */ public void enterText(final WebElement element, final String text, boolean clear, boolean inject, final boolean check) { removeNotifications(); waitForNotificationsGone(); scrollIntoView(element); triggerScreenshot("_pretext"); waitForAMoment().withMessage("editable: " + element.toString()) .until(ExpectedConditions.elementToBeClickable(element)); if (inject) { if (clear) { element.clear(); } element.sendKeys(text); } else { Actions enterTextAction = new Actions(getDriver()).moveToElement(element); enterTextAction = enterTextAction.click(); // Fields can 'blur' on click waitForPageSilence(); if (clear) { enterTextAction = enterTextAction.sendKeys(Keys.chord(Keys.CONTROL, "a")).sendKeys(Keys.DELETE); // Fields can 'blur' on clear waitForPageSilence(); } enterTextAction.sendKeys(text).perform(); } if (check) { waitForAMoment().withMessage("Text equal to entered").until((Predicate<WebDriver>) webDriver -> { String foundText = element.getAttribute("value"); if (!text.equals(foundText)) { log.info("Found: {}", foundText); triggerScreenshot("_textWaiting"); return false; } return true; }); } else { log.info("Not checking text entered"); } triggerScreenshot("_text"); }
From source file:Tests.testCars.java
@Test //Verify data reset after clearing filter textbox public void t3_verifyFilterReset() throws Exception { WebElement filterbox = driver.findElement(By.id("filter")); // .clear() didn't work. So doubleclick + backspace. filterbox.sendKeys(Keys.chord(Keys.CONTROL, "a"), Keys.DELETE); WebElement e = driver.findElement(By.tagName("tbody")); List<WebElement> rows = e.findElements(By.tagName("tr")); // 2 fords should now be seen Assert.assertThat(rows.size(), is(5)); }
From source file:Tests.testCars.java
@Test //Verify that the row for car with id 938 now contains "Cool car" in the Description column public void t5_verifyEditingCar() throws Exception { // reset for good measure com.jayway.restassured.RestAssured.given().get("http://localhost:3000/reset"); driver.findElement(By.xpath("//tbody/tr[td//text()[contains(., '938')]]/td[8]/a[. = 'Edit']")).click(); WebElement descriptionTextbox = driver.findElement(By.id("description")); descriptionTextbox.sendKeys(Keys.chord(Keys.CONTROL, "a"), Keys.DELETE); descriptionTextbox.sendKeys("Cool car"); driver.findElement(By.id("save")).click(); WebElement td = driver.findElement(By.xpath("//tbody/tr[td//text()[contains(., '938')]]/td[6]")); Assert.assertThat(td.getText(), is("Cool car")); }