List of usage examples for org.openqa.selenium Keys ARROW_DOWN
Keys ARROW_DOWN
To view the source code for org.openqa.selenium Keys ARROW_DOWN.
Click Source Link
From source file:com.gargoylesoftware.htmlunit.selenium.TypingTest.java
License:Apache License
/** * A test./*from w w w.j a v a 2 s .c o m*/ */ @Test public void shouldReportKeyCodeOfArrowKeysUpDownEvents() { final WebDriver driver = getWebDriver("/javascriptPage.html"); final WebElement result = driver.findElement(By.id("result")); final WebElement element = driver.findElement(By.id("keyReporter")); element.sendKeys(Keys.ARROW_DOWN); assertThat(result.getText().trim(), containsString("down: 40")); assertThat(result.getText().trim(), containsString("up: 40")); element.sendKeys(Keys.ARROW_UP); assertThat(result.getText().trim(), containsString("down: 38")); assertThat(result.getText().trim(), containsString("up: 38")); element.sendKeys(Keys.ARROW_LEFT); assertThat(result.getText().trim(), containsString("down: 37")); assertThat(result.getText().trim(), containsString("up: 37")); element.sendKeys(Keys.ARROW_RIGHT); assertThat(result.getText().trim(), containsString("down: 39")); assertThat(result.getText().trim(), containsString("up: 39")); // And leave no rubbish/printable keys in the "keyReporter" assertThat(element.getAttribute("value"), is("")); }
From source file:com.github.fscheffer.arras.demo.DropdownIT.java
License:Apache License
@Test public void testKeyInteraction() { // check keys click("#drop_1"); sendKeys(Keys.ARROW_DOWN); waitUntil(focused(dropdownItem(1))); // cant move up. it's the first element. focus should stay on the first element sendKeys(Keys.ARROW_UP);/*from w ww . java 2 s .c om*/ waitUntil(focused(dropdownItem(1))); sendKeys(Keys.ARROW_DOWN); waitUntil(focused(dropdownItem(2))); // skip divider sendKeys(Keys.ARROW_DOWN); waitUntil(focused(dropdownItem(4))); // cant move down. we are at the last element. focus should stay on the last element sendKeys(Keys.ARROW_DOWN); waitUntil(focused(dropdownItem(4))); // skip divider sendKeys(Keys.ARROW_UP); waitUntil(focused(dropdownItem(2))); sendKeys(Keys.ESCAPE); waitUntil(notContainsText("BODY", "Item 1")); waitUntil(focused("ul.nav.nav-pills > li:nth-child(2) > a")); }
From source file:com.hotwire.selenium.tools.c3.casenotes.C3CaseNotesFrame.java
License:Open Source License
public void selectTermOfUse() { findOne("select#termsOfUse").sendKeys(Keys.ARROW_DOWN); }
From source file:com.liferay.faces.test.Primefaces4UsersPortletTest.java
License:Open Source License
@Test // Not applicable for Liferay Portal 6.0 @RunAsClient/*from www. j av a2s .co m*/ @InSequence(0) public void testSetupActivateUser() throws Exception { browser.manage().window().maximize(); signIn(browser); (new Actions(browser)).click(dropdownTestSetup); if (!controlPanelTestSetup.isDisplayed()) { dropdownTestSetup.click(); } controlPanelTestSetup.click(); waitForElement(browser, usersLinkTestSetupXpath); usersLinkTestSetup.click(); waitForElement(browser, searchAllUsersLinkTestSetupXpath); if (!isThere(browser, johnAdamsTestSetupXpath) || !johnAdamsTestSetup.isDisplayed()) { searchAllUsersLinkTestSetup.click(); waitForElement(browser, backLinkTestSetupXpath); if (isThere(browser, advancedSearchLinkTestSetupXpath) && advancedSearchLinkTestSetup.isDisplayed()) { advancedSearchLinkTestSetup.click(); } waitForElement(browser, selectStatusTestSetupXpath); selectStatusTestSetup.click(); (new Actions(browser)).sendKeys(Keys.ARROW_DOWN).sendKeys(Keys.TAB).perform(); Thread.sleep(250); if (isThere(browser, johnAdamsTestSetupXpath)) { //no-op } else { selectStatusTestSetup.submit(); Thread.sleep(250); } if (isThere(browser, johnAdamsTestSetupXpath)) { johnAdamsMenuTestSetup.click(); activateJohnAdamsTestSetup.click(); } waitForElement(browser, usersLinkTestSetupXpath); } }
From source file:com.thoughtworks.selenium.webdriven.commands.TypeKeys.java
License:Apache License
@Override protected Void handleSeleneseCommand(WebDriver driver, String locator, String value) { alertOverride.replaceAlertMethod(driver); value = value.replace("\\10", Keys.ENTER); value = value.replace("\\13", Keys.RETURN); value = value.replace("\\27", Keys.ESCAPE); value = value.replace("\\38", Keys.ARROW_UP); value = value.replace("\\40", Keys.ARROW_DOWN); value = value.replace("\\37", Keys.ARROW_LEFT); value = value.replace("\\39", Keys.ARROW_RIGHT); finder.findElement(driver, locator).sendKeys(value); return null;/* w w w .j av a 2 s. com*/ }
From source file:com.thoughtworks.selenium.webdriven.commands.TypeKeysTest.java
License:Apache License
@Test public void substitutesArrowKeys() { String expected = newString(Keys.ARROW_DOWN, Keys.ARROW_LEFT, Keys.ARROW_RIGHT, Keys.ARROW_UP); String input = "\\40\\37\\39\\38"; new TypeKeys(new AlertOverrideStub(), elementFinder).apply(null, new String[] { "foo", input }); verify(element).sendKeys(expected);//from w w w. ja v a2 s .c o m }
From source file:com.vaadin.tests.components.combobox.ComboboxPageLengthZeroScrollTest.java
License:Apache License
@Test public void testComboboxPageLength() { openTestURL();/*from w w w.ja v a 2 s .co m*/ WebElement comboBox = vaadinElement( "/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VFilterSelect[0]#textbox"); // navigate to the next page. keyboard navigation is the preferred // method here since it's much easier to implement. Actions keyNavigation = new Actions(driver).moveToElement(comboBox).click(); for (int i = 0; i < 25; ++i) { keyNavigation.sendKeys(Keys.ARROW_DOWN); } keyNavigation.perform(); // The broken behavior always caused a v-shadow element to have // height: 10px. Verify that this does no longer happen. String cssValue = driver.findElement(By.className("v-shadow")).getCssValue("height"); Assert.assertNotEquals("v-shadow height should not be 10px", "10px", cssValue); }
From source file:com.vaadin.tests.components.grid.basicfeatures.client.GridClientKeyEventsTest.java
License:Apache License
@Test public void selectAllUsingKeyboard() { openTestURL();/*from w w w . j a va2 s . c om*/ selectMenuPath("Component", "Header", "Prepend row"); selectMenuPath("Component", "Header", "Append row"); selectMenuPath("Component", "State", "Selection mode", "multi"); // IE8 does not handle 1k rows well with assertions enabled. Less rows! selectMenuPath("Component", "DataSource", "Reset with 100 rows of Data"); // Focus cell above select all checkbox getGridElement().getHeaderCell(0, 0).click(); Assert.assertFalse(isRowSelected(1)); new Actions(getDriver()).sendKeys(" ").perform(); Assert.assertFalse(isRowSelected(1)); // Move down to select all checkbox cell new Actions(getDriver()).sendKeys(Keys.ARROW_DOWN).perform(); Assert.assertFalse(isRowSelected(1)); new Actions(getDriver()).sendKeys(" ").perform(); // select all Assert.assertTrue(isRowSelected(1)); new Actions(getDriver()).sendKeys(" ").perform(); // deselect all Assert.assertFalse(isRowSelected(1)); // Move down to header below select all checkbox cell new Actions(getDriver()).sendKeys(Keys.ARROW_DOWN).perform(); Assert.assertFalse(isRowSelected(1)); new Actions(getDriver()).sendKeys(" ").perform(); // deselect all Assert.assertFalse(isRowSelected(1)); }
From source file:com.vaadin.tests.components.grid.basicfeatures.client.GridClientSelectionTest.java
License:Apache License
@Test public void testDeselectAllowedKeyboardInput() { openTestURL();/* w ww .j ava 2 s . co m*/ setSelectionModelSingle(true); getGridElement().getHeaderCell(0, 0).click(); new Actions(getDriver()).sendKeys(Keys.ARROW_DOWN).perform(); new Actions(getDriver()).sendKeys(Keys.SPACE).perform(); assertTrue("Row 0 should be selected after pressing space", isRowSelected(0)); new Actions(getDriver()).sendKeys(Keys.ARROW_DOWN).perform(); new Actions(getDriver()).sendKeys(Keys.SPACE).perform(); assertFalse("Row 0 should be deselected after pressing space another row", isRowSelected(0)); assertTrue("Row 1 should be selected after pressing space", isRowSelected(1)); new Actions(getDriver()).sendKeys(Keys.SPACE).perform(); assertFalse("Row should be deselected after pressing space again", isRowSelected(1)); }
From source file:com.vaadin.tests.components.grid.basicfeatures.client.GridClientSelectionTest.java
License:Apache License
@Test public void testDeselectNotAllowedKeyboardInput() { openTestURL();/*from w w w .j av a2s. c o m*/ setSelectionModelSingle(false); getGridElement().getHeaderCell(0, 0).click(); new Actions(getDriver()).sendKeys(Keys.ARROW_DOWN).perform(); new Actions(getDriver()).sendKeys(Keys.SPACE).perform(); assertTrue("Row 0 should be selected after pressing space", isRowSelected(0)); new Actions(getDriver()).sendKeys(Keys.ARROW_DOWN).perform(); new Actions(getDriver()).sendKeys(Keys.SPACE).perform(); assertFalse("Row 0 should be deselected after pressing space another row", isRowSelected(0)); assertTrue("Row 1 should be selected after pressing space", isRowSelected(1)); new Actions(getDriver()).sendKeys(Keys.SPACE).perform(); assertTrue("Row should remain selected after pressing space again", isRowSelected(1)); }