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:org.alfresco.po.share.site.document.FilmstripActions.java
License:Open Source License
/** * Filmstrip view send right arrow./*from ww w. j a v a 2 s .c om*/ */ public HtmlPage sendKeyRightArrowForFilmstrip() { return sendKeysFilmStripViewElement("Send right key ", Keys.TAB, Keys.ARROW_RIGHT); }
From source file:org.alfresco.po.share.site.document.FilmstripActions.java
License:Open Source License
/** * Filmstrip view send left arrow./*from ww w. j a v a2s . com*/ */ public HtmlPage sendKeyLeftArrowForFilmstrip() { return sendKeysFilmStripViewElement("Send left key ", Keys.TAB, Keys.ARROW_LEFT); }
From source file:org.alfresco.po.share.site.document.FilmstripActions.java
License:Open Source License
/** * Filmstrip view send right arrow./*from w w w .ja va 2 s .co m*/ */ public HtmlPage sendKeyUpArrowForFilmstrip() { return sendKeysFilmStripViewElement("Send Up Arrow ", Keys.TAB, Keys.ARROW_UP); }
From source file:org.alfresco.po.share.site.document.FilmstripActions.java
License:Open Source License
/** * Filmstrip view send left arrow./*from w w w . j av a2 s .co m*/ */ public HtmlPage sendKeyDownArrowForFilmstrip() { return sendKeysFilmStripViewElement("Send Down Arrow ", Keys.TAB, Keys.ARROW_DOWN); }
From source file:org.aludratest.service.gui.web.selenium.selenium2.Selenium2Wrapper.java
License:Apache License
private void setValue(WebElement element, String value) { LOGGER.debug("setValue(WebElement, {})", value); sendKeys(element, Keys.END);/*from w ww. ja va 2s . c o m*/ String text; int tryCounter = 3; while (tryCounter > 0 && !DataMarkerCheck.isNull(text = getValue(element))) { int length = text.length(); String[] arr = new String[length]; for (int i = 0; i < length; i++) { arr[i] = "\b"; } sendKeys(element, arr); tryCounter--; } if (tryCounter == 0) { throw new AutomationException("Could not clear input field. Maybe covered by other component?"); } sendKeys(element, value); try { sendKeys(element, Keys.TAB); } catch (StaleElementReferenceException e) { // ignore; key could have caused page change LOGGER.debug("Could not fire change event for element because element is now stale."); } catch (WebDriverException e) { // of course, PhantomJS does NOT throw a StaleElementReferenceException, but some evil error... if (e.getMessage() != null && e.getMessage().matches("(?s).*'?undefined'? is not a .*")) { LOGGER.debug("Could not fire change event for element because element is now stale."); } else { throw e; } } }
From source file:org.asqatasun.sebuilder.interpreter.TgTestRun.java
License:Open Source License
/** * /*from www . ja v a2s. c om*/ * @param url */ private void getSourceCodeAndFireNewPage(String url) { try { try { Thread.sleep(500); } catch (InterruptedException ex) { throw new TestRunException(currentStep() + " failed.", ex, currentStep().toString(), stepIndex); } String sourceCode = getDriver().getPageSource(); /* ############################################################## * ACHTUNG !!!!!!!!!!!!!!!!!!!!!!!!!! * this sendKeys action is here to grab the focus on the page. * It is needed later by the js script to execute the focus() * method on each element. Without it, the focus is kept by the adress * bar. */ WebElement body = getDriver().findElementByTagName("html"); Map<String, String> jsScriptResult = Collections.EMPTY_MAP; try { body.sendKeys(Keys.TAB); jsScriptResult = executeJsScripts(); } catch (WebDriverException wde) { getLog().warn(wde.getMessage()); } /*##############################################################*/ /* byte[] snapshot = createPageSnapshot();*/ for (NewPageListener npl : newPageListeners) { npl.fireNewPage(url, sourceCode, null, jsScriptResult); } } catch (UnhandledAlertException uae) { getLog().warn(uae.getMessage()); throw new TestRunException(currentStep() + " failed.", uae, currentStep().toString(), stepIndex); } }
From source file:org.auraframework.components.ui.inputDate.BaseInputDateUITester.java
License:Apache License
@ExcludeBrowsers({ BrowserType.IE9, BrowserType.IE10, BrowserType.SAFARI, BrowserType.ANDROID_PHONE, BrowserType.ANDROID_TABLET, BrowserType.IPAD, BrowserType.IPHONE }) public void testShiftTab() throws Exception { open(URL);/*from www .j av a 2 s. c o m*/ WebDriver driver = getDriver(); // Tab test Begins // Getting input textbox in focus WebElement element = findDomElement(By.cssSelector(DATE_INPUT_BOX_SEL)); element.click(); element.sendKeys("11111111"); auraUITestingUtil.pressTab(element); String classOfActiveElem = "a[class*='" + auraUITestingUtil.getEval(CLASSNAME) + "']"; element = findDomElement(By.cssSelector(classOfActiveElem)); element.click(); // Focused on Today's date, grabbing it and pressing tab to go to the Today hyperlink classOfActiveElem = "a[class*='" + auraUITestingUtil.getEval(CLASSNAME) + "']"; element = findDomElement(By.cssSelector(classOfActiveElem)); auraUITestingUtil.pressTab(element); String shftTab = Keys.SHIFT + "" + Keys.TAB; // Going from Today hyperlink, back to SELECTED_DATE gotToNextElem(driver, shftTab); // Going from SELECTED_DATE to next-year gotToNextElem(driver, shftTab); // Going from next-year to next-month gotToNextElem(driver, shftTab); // Going from next-month to prev-month gotToNextElem(driver, shftTab); // Going from prev-month to prev-Year gotToNextElem(driver, shftTab); // Going from prev-Year to icon gotToNextElem(driver, shftTab); // Going from icon to input box gotToNextElem(driver, shftTab); // Getting the input textbox in focus and getting the value, which should not have changed classOfActiveElem = "input[class*='" + auraUITestingUtil.getEval(CLASSNAME) + "']"; element = findDomElement(By.cssSelector(classOfActiveElem)); assertEquals("Shift Tabbing did not get us to the input textbox", "1111-11-11", element.getAttribute("value")); }
From source file:org.auraframework.components.ui.inputDate.InputDateWithLabelUITest.java
License:Apache License
@UnAdaptableTest // Checking functionality of the shift tab button @ExcludeBrowsers({ BrowserType.IE9, BrowserType.IE10, BrowserType.SAFARI, BrowserType.ANDROID_PHONE, BrowserType.ANDROID_TABLET, BrowserType.IPAD, BrowserType.IPHONE }) public void testShiftTab() throws Exception { open(URL);//from w ww . j a v a 2 s. c om WebDriver driver = getDriver(); // Tab test Begins // Getting input textbox in focus WebElement element = findDomElement(By.cssSelector(DATE_INPUT_BOX_SEL)); element.click(); element.sendKeys("11111111"); auraUITestingUtil.pressTab(element); String classOfActiveElem = "a[class*='" + auraUITestingUtil.getEval(CLASSNAME) + "']"; element = findDomElement(By.cssSelector(classOfActiveElem)); element.click(); // Focused on Today's date, grabbing it and pressing tab to go to the Today hyperlink classOfActiveElem = "a[class*='" + auraUITestingUtil.getEval(CLASSNAME) + "']"; element = findDomElement(By.cssSelector(classOfActiveElem)); auraUITestingUtil.pressTab(element); String shftTab = Keys.SHIFT + "" + Keys.TAB; // Going from Today hyperlink, back to SELECTED_DATE // gotToNextElem(driver, shftTab); String classOfActiveElemButton = "button[class*='" + auraUITestingUtil.getEval(CLASSNAME) + "']"; findDomElement(By.cssSelector(classOfActiveElemButton)).sendKeys(shftTab); // Going from SELECTED_DATE to next-year gotToNextElem(driver, shftTab); // Going from next-year to next-month gotToNextElem(driver, shftTab); // Going from next-month to prev-month gotToNextElem(driver, shftTab); // Going from prev-month to prev-Year gotToNextElem(driver, shftTab); // Going from prev-Year to icon gotToNextElem(driver, shftTab); // Going from icon to input box gotToNextElem(driver, shftTab); // Getting the input textbox in focus and getting the value, which should not have changed classOfActiveElem = "input[class*='" + auraUITestingUtil.getEval(CLASSNAME) + "']"; element = findDomElement(By.cssSelector(classOfActiveElem)); assertEquals("Shift Tabbing did not get us to the input textbox", "1111-11-11", element.getAttribute("value")); }
From source file:org.auraframework.components.ui.InputSelectUITest.java
License:Apache License
@ExcludeBrowsers({ BrowserType.IPAD, BrowserType.ANDROID_PHONE, BrowserType.ANDROID_TABLET, BrowserType.IPHONE })//from w ww. ja va2 s. c o m public void testMultipleSelect() throws Exception { d = getDriver(); String selectLocator = "select[class~='multiple']"; String valueExpr = "return window.$A.getRoot().find('InputSelectMultiple').getAttributes().getValue('value').getValue();"; open("/uitest/inputSelect_OptionsInBody.cmp"); WebElement inputSelectElement = d.findElement(By.cssSelector(selectLocator)); Select inputSelect = new Select(inputSelectElement); // Assert element visible assertTrue("InputSelect not visible", inputSelectElement.isDisplayed()); // Initial selected aoption List<WebElement> selectedOptions = inputSelect.getAllSelectedOptions(); assertTrue(selectedOptions.size() == 2); assertTrue("Lion not in expected otpions", isOptionSelected("Lion", selectedOptions)); assertTrue("Bear not in expected otpions", isOptionSelected("Bear", selectedOptions)); // Checking value via Aura framework String compValue = (String) ((JavascriptExecutor) d).executeScript(valueExpr); assertNotNull(compValue); String[] selectedValues = compValue.split(";"); assertTrue("Lion not returned in component values", Arrays.asList(selectedValues).contains("Lion")); assertTrue("Bear not returned in component values", Arrays.asList(selectedValues).contains("Bear")); // Adding Click to focus Element before tabing out so that it works on // IE10. inputSelectElement.click(); // change selection inputSelectElement.click(); inputSelect.selectByValue("Butterfly"); inputSelectElement.sendKeys(Keys.TAB); selectedOptions = inputSelect.getAllSelectedOptions(); assertTrue("Butterfly not in expected otpions", isOptionSelected("Butterfly", selectedOptions)); // Checking value via Aura framework compValue = (String) ((JavascriptExecutor) d).executeScript(valueExpr); assertNotNull(compValue); selectedValues = compValue.split(";"); assertTrue("Butterfly not returned in component values", Arrays.asList(selectedValues).contains("Butterfly")); }
From source file:org.auraframework.components.ui.listSorter.ListSorterUITest.java
License:Apache License
/** * Tab out should not close the sorter dialog The focus should remain in the Sorter Menu Test case for W-1985435 * //from w w w .ja va2s . com * @throws MalformedURLException * @throws URISyntaxException */ @PerfTest public void testTabOutOfListSorter() throws MalformedURLException, URISyntaxException { verifyTabOutAndEscBehaviour(Keys.TAB, true); }