List of usage examples for org.openqa.selenium Keys TAB
Keys TAB
To view the source code for org.openqa.selenium Keys TAB.
Click Source Link
From source file:edreams.PageObject.EdreamsSearchPage.java
public void search(String FromAirport, String toAirport, int numAdults, int numchilds) { System.out.println("Select flight"); driver.findElement(ManageFlightBtn).click(); System.out.println("clean From airport"); //inputFrom.clear(); driver.findElement(FromAirportTxtB).clear(); if (!FromAirport.isEmpty()) { System.err.println("add airport filter"); driver.findElement(FromAirportTxtB).sendKeys("Mad"); try {//from w w w. j a va2 s. c o m Thread.sleep(5000); //wait a bit to the modal! and then press return. } catch (InterruptedException ex) { Logger.getLogger(EdreamsSearchPage.class.getName()).log(Level.SEVERE, null, ex); } driver.findElement(FromAirportTxtB).sendKeys(Keys.RETURN); driver.findElement(FromAirportTxtB).sendKeys(Keys.TAB); } System.out.println("clean From airport"); //while numAdults.. Click //while numChlds.. Click driver.findElement(By.xpath("//div[@id='pax-selector']/div/div/div/span[2]")).click(); driver.findElement(By.cssSelector("div.od-aside-button.inc")).click(); driver.findElement(By.xpath("//div[@id='pax-selector']/div/div/div[2]/div[2]/div/div[2]/div/div[3]")) .click(); driver.findElement(By.xpath("//div[@id='pax-selector']/div/div/div[2]/div[3]/div/div[2]/div/div[3]")) .click(); driver.findElement(By.xpath("//div[@id='pax-selector']/div/div/div[2]/div[3]/div/div[2]/div/div[2]")) .click(); driver.findElement(By.xpath("//div[@id='pax-selector']/div/div/div[2]/div[2]/div/div[2]/div/div[2]")) .click(); }
From source file:info.magnolia.integrationtests.uitest.ContentAppUITest.java
License:Open Source License
@Test public void tabNavigatesToNextField() { // GIVEN/*from ww w. java 2 s.c o m*/ getAppIcon("Contacts").click(); waitUntil(appIsLoaded()); assertAppOpen("Contacts"); getTreeTableItem("Albert Einstein").click(); getActionBarItem("Edit contact").click(); waitUntil(dialogIsOpen("Edit contact")); //moveToElement(getFormTextField("Salutation")); // Moving to element is not necessary as it is already focused WebElement currentlyFocusedElement = getFocusedElement(); assertThat(currentlyFocusedElement, is(getFormTextField("Salutation"))); // WHEN simulateKeyPress(Keys.TAB); delay(2, "Can take some time, until tab is responded to."); // THEN currentlyFocusedElement = getFocusedElement(); assertThat("Pressing tab should have passed focus to next field.", currentlyFocusedElement, is(getFormTextField("First name"))); }
From source file:info.magnolia.integrationtests.uitest.FavoriteUITest.java
License:Open Source License
@Test public void addFavoriteAndGroupSimultaneously() { // GIVEN// w w w . j a va 2s . c om getAppIcon("Pages").click(); waitUntil(appIsLoaded()); getTreeTableItem("ftl-sample-site").click(); getShellIconFavorites().click(); waitUntil(shellAppIsLoaded(ShellApp.FAVORITES)); // WHEN getButton("dialog-header", "Add new").click(); WebElement groupComboBox = getElement( By.xpath("//*[contains(@class, 'v-filterselect')]/*[@class = 'v-filterselect-input']")); String newGroupName = String.valueOf((new Date()).getTime()); groupComboBox.sendKeys(newGroupName); simulateKeyPress(Keys.TAB); getButton("v-button-commit", "Add").click(); // THEN WebElement newGroupElement = null; List<WebElement> groupTitles = getElementsByXpath( "//div[contains(@class, 'favorites-group-title')]/*[contains(@class, 'v-textfield')]"); for (WebElement element : groupTitles) { if (newGroupName.equals(element.getAttribute("value"))) { newGroupElement = element; break; } } assertNotNull(newGroupElement); WebElement newFavoriteElement = newGroupElement .findElement(By.xpath("//*[contains(concat(' ', @class, ' '), ' favorites-entry ')]")); assertNotNull(newFavoriteElement); // let's delete the group finally (which makes it easier for upcoming tests) removeExistingItems(); }
From source file:info.magnolia.integrationtests.uitest.FavoriteUITest.java
License:Open Source License
@Test public void testShowHideEditDeleteIcons() { // GIVEN/*from w w w .ja v a2 s . co m*/ // create new entry (new fav in new group = 2 items) getAppIcon("Pages").click(); waitUntil(appIsLoaded()); getTreeTableItem("ftl-sample-site").click(); getShellIconFavorites().click(); waitUntil(shellAppIsLoaded(ShellApp.FAVORITES)); getButton("dialog-header", "Add new").click(); WebElement groupComboBox = getElement( By.xpath("//*[contains(@class, 'v-filterselect')]/*[@class = 'v-filterselect-input']")); String newGroupName = String.valueOf((new Date()).getTime()); groupComboBox.sendKeys(newGroupName); simulateKeyPress(Keys.TAB); getButton("v-button-commit", "Add").click(); // WHEN // edit-state: => expecting to have 2x2 icons) getEditFavoritesButton().click(); // THEN List<WebElement> trashIconElementsList = getElements(By.xpath("//*[@class = 'icon-trash']")); assertEquals(trashIconElementsList.size(), 2); List<WebElement> editIconElementsList = getElements(By.xpath("//*[@class = 'icon-edit']")); assertEquals(editIconElementsList.size(), 2); // WHEN // non-edit-state: => expecting no more icons but expecting to run into TimeoutException when trying to fetch the elements by x-path getEditFavoritesButton().click(); // THEN waitUntil(elementIsGone("//*[@class = 'icon-trash']")); // clean-up at the end ... removeExistingItems(); }
From source file:info.magnolia.integrationtests.uitest.KeyboardShortcutUITest.java
License:Open Source License
@Test public void focusIsNotLostIfThereIsNotAnotherItemToEdit() throws Exception { // GIVEN//from w w w .j av a2 s. c o m getAppIcon("Configuration").click(); waitUntil(appIsLoaded()); assertAppOpen("Configuration"); getTreeTableItem("server").click(); // WHEN getKeyboard().pressKey(Keys.chord(Keys.SHIFT, Keys.TAB)); delay(1, "Wait for key press"); // THEN // make sure server node is still selected assertTrue(isTreeTableItemSelected("server")); // WHEN getKeyboard().pressKey(Keys.ENTER); delay(1, "Wait for key press"); // THEN // check if we're in inline editing mode assertThat(getEditedElement().getTagName(), is("input")); }
From source file:info.magnolia.integrationtests.uitest.KeyboardShortcutUITest.java
License:Open Source License
@Test public void selectionIsOnCorrectRowWhenCyclingUsingTab() throws Exception { // GIVEN//from ww w . j a v a2 s.co m getAppIcon("Configuration").click(); waitUntil(appIsLoaded()); assertAppOpen("Configuration"); getTreeTableItemExpander("server").click(); getTreeTableItem("server").click(); getTreeTableItem("admin").click(); // WHEN // edit admin property and cycle 3 times using tab getKeyboard().pressKey(Keys.ENTER); delay(1, "Wait for key press"); getKeyboard().pressKey(Keys.TAB); delay(1, "Wait for key press"); getKeyboard().pressKey(Keys.TAB); delay(1, "Wait for key press"); getKeyboard().pressKey(Keys.TAB); delay(1, "Wait for key press"); getKeyboard().pressKey(Keys.ENTER); // THEN assertTrue(isTreeTableItemSelected("defaultBaseUrl")); // WHEN // now cycle back to admin property getKeyboard().pressKey(Keys.ENTER); delay(1, "Wait for key press"); getKeyboard().pressKey(Keys.chord(Keys.SHIFT, Keys.TAB)); delay(1, "Wait for key press"); getKeyboard().pressKey(Keys.chord(Keys.SHIFT, Keys.TAB)); delay(1, "Wait for key press"); getKeyboard().pressKey(Keys.chord(Keys.SHIFT, Keys.TAB)); delay(1, "Wait for key press"); getKeyboard().pressKey(Keys.ENTER); delay(1, "Wait for key press"); // THEN assertTrue(isTreeTableItemSelected("admin")); }
From source file:info.magnolia.integrationtests.uitest.KeyboardShortcutUITest.java
License:Open Source License
@Test public void itIsPossibleToCycleBetweenPropertiesAndNodes() throws Exception { // GIVEN//from w w w . j a va 2s. c om getAppIcon("Configuration").click(); waitUntil(appIsLoaded()); assertAppOpen("Configuration"); getTreeTableItemExpander("server").click(); delay(1, "Wait so item gets expanded"); getTreeTableItem("server").click(); delay(1, "Wait for item to be selected"); getTreeTableItem("admin").click(); delay(1, "Wait for item to be selected"); // WHEN // cycle back to auditLogging node getKeyboard().pressKey(Keys.ENTER); delay(1, "Wait for key press"); getKeyboard().pressKey(Keys.chord(Keys.SHIFT, Keys.TAB)); delay(1, "Wait for key press"); getKeyboard().pressKey(Keys.chord(Keys.SHIFT, Keys.TAB)); delay(1, "Wait for key press"); getKeyboard().pressKey(Keys.chord(Keys.SHIFT, Keys.TAB)); delay(1, "Wait for key press"); getKeyboard().pressKey(Keys.ENTER); delay(1, "Wait for key press"); // THEN assertTrue(isTreeTableItemSelected("auditLogging")); // WHEN // now cycle back to admin property getKeyboard().pressKey(Keys.ENTER); delay(1, "Wait for key press"); getKeyboard().pressKey(Keys.TAB); delay(1, "Wait for key press"); getKeyboard().pressKey(Keys.TAB); delay(1, "Wait for key press"); getKeyboard().pressKey(Keys.TAB); delay(1, "Wait for key press"); getKeyboard().pressKey(Keys.ENTER); delay(1, "Wait for key press"); // THEN assertTrue(isTreeTableItemSelected("admin")); }
From source file:io.fabric8.selenium.inputs.ComboCompleteInputValue.java
License:Apache License
@Override public WebElement doInput() { final WebDriverFacade facade = getFacade(); final By firstBy = getBy(); facade.sleep(Millis.seconds(2));/*from ww w.j ava2 s .c o m*/ WebElement element = facade.findOptionalElement(firstBy); if (element == null) { return null; } super.doInputOnElement(element); logInput("" + firstBy + " value: " + getValue()); facade.sleep(Millis.seconds(2)); element = facade.findOptionalElement(firstBy); if (element != null) { element.sendKeys(Keys.TAB); facade.sleep(Millis.seconds(2)); element = facade.findOptionalElement(firstBy); } return element; }
From source file:jhc.redsniff.webdriver.SeleniumController.java
License:Apache License
protected void blurByTypingTabKey(WebElement element) { new Actions(driver).click(element).sendKeys(Keys.TAB).perform(); }
From source file:org.alfresco.po.share.cmm.admin.CreateNewPropertyPopUp.java
License:Open Source License
/** * Sets the default boolean value field. * // ww w . java 2s . c o m * @param value the value * @return the CreateNewPropertyPopUp */ public void setDefaultBooleanValueField(String value) { if ("true".equalsIgnoreCase(value)) { try { WebElement booleanDefault = findAndWait(DEFAULT_VALUE_FIELD_BOOLEAN); SelectList list = new SelectList(driver, booleanDefault); list.selectValue("True", true); booleanDefault.sendKeys(Keys.TAB); } catch (TimeoutException toe) { throw new PageOperationException("Not visible Element: DEFAULT_VALUE_FIELD_BOOLEAN", toe); } } }