List of usage examples for org.openqa.selenium Keys ENTER
Keys ENTER
To view the source code for org.openqa.selenium Keys ENTER.
Click Source Link
From source file:org.auraframework.integration.test.components.ui.inputDateTime.InputDateTimeUITest.java
License:Apache License
/** * Test Flow:/* w w w .j ava 2 s . c o m*/ * - check if focus is back to inputTimeBox after pressing ENTER on timePicker * @throws Exception */ @Test public void testTPFocusOnClosingWithEnterKey() throws Exception { open(URL); checkTPFocusOnClosingWithKey(Keys.ENTER); }
From source file:org.auraframework.integration.test.components.ui.menu.MenuUITest.java
License:Apache License
private void testMenuCheckboxForApp(String appName) throws Exception { open(appName);//w w w . j a va 2s. co m WebDriver driver = this.getDriver(); String label = "checkboxMenuLabel"; String menuName = "checkboxMenu"; String menuItem3 = "checkboxItem3"; String menuItem4 = "checkboxItem4"; WebElement menuLabel = driver.findElement(By.className(label)); WebElement menu = driver.findElement(By.className(menuName)); WebElement button = driver.findElement(By.className("checkboxButton")); By resultLocator = By.className("checkboxMenuResult"); // check for default label present assertEquals("label is wrong", "NFC West Teams", menuLabel.getText()); assertFalse("Default: CheckboxMenu list should not be visible", menu.getAttribute("class").contains("visible")); openMenu(menuLabel, menu); WebElement item3 = driver.findElement(By.className(menuItem3)); WebElement item3Element = getAnchor(item3); WebElement item4 = driver.findElement(By.className(menuItem4)); WebElement item4Element = getAnchor(item4); // verify aria attribute item4 which is used for accessibility is disabled and selected assertTrue("Item4 aria attribute should be disabled", Boolean.valueOf(item4Element.getAttribute("aria-disabled"))); assertTrue("Item4 aria attribute should be selected", Boolean.valueOf(item4Element.getAttribute("aria-checked"))); // verify item4 is disabled and selected assertTrue("Item4 should be disabled", getCmpBoolAttribute(menuItem4, "v.disabled")); assertTrue("Item4 should be selected", getCmpBoolAttribute(menuItem4, "v.selected")); // item4Element is not clickable as it's disabled via markup tryToClickDisabledElm(item4Element); assertTrue("Item4 aria attribute should be Selected even when clicked", Boolean.valueOf(item4Element.getAttribute("aria-checked"))); assertTrue("Item4 should be Selected even when clicked", getCmpBoolAttribute(menuItem4, "v.selected")); assertFalse("default: Item3 aria attribute should be Unchecked", Boolean.valueOf(item3Element.getAttribute("aria-checked"))); assertFalse("default: Item3 should be Unchecked", getCmpBoolAttribute(menuItem3, "v.selected")); // check item3 with click item3Element.click(); getAuraUITestingUtil().waitUntil(check -> Boolean.valueOf(item3Element.getAttribute("aria-checked")), "Item3 aria attribute should be checked after the click"); assertTrue("Item3 v.selected should be true after the click", getCmpBoolAttribute(menuItem3, "v.selected")); // uncheck item3 with ENTER key item3Element.sendKeys(Keys.ENTER); getAuraUITestingUtil().waitUntil(check -> !Boolean.valueOf(item3Element.getAttribute("aria-checked")), "Item3 aria attribute should be uncheked after pressing ENTER"); assertFalse("Item3 v.selected should be false after pressing ENTER", getCmpBoolAttribute(menuItem3, "v.selected")); // check item3 with SPACE key item3Element.sendKeys(Keys.SPACE); getAuraUITestingUtil().waitUntil(check -> Boolean.valueOf(item3Element.getAttribute("aria-checked")), "Item3 aria attribute should be checked after pressing SPACE"); assertTrue("Item3 v.selected should be true after pressing SPACE", getCmpBoolAttribute(menuItem3, "v.selected")); // check if focus changes when you use up and down arrow using keyboard item3Element.sendKeys(Keys.DOWN); waitForFocusOnElement(item4Element); item4Element.sendKeys(Keys.UP); waitForFocusOnElement(item3Element); // press Tab to close to menu item3Element.sendKeys(Keys.TAB); waitForMenuClose(menu); // click on submit button and verify the results assertEquals("label value should not get updated", "NFC West Teams", menuLabel.getText()); button.click(); getAuraUITestingUtil().waitForElementText(resultLocator, "St. Louis Rams,Arizona Cardinals", true); }
From source file:org.auraframework.integration.test.components.ui.tabset.TabsetUITest.java
License:Apache License
/** * Test to navigate from a random tab to the overflow menu using the tab key and open the overflow menu * using the UP arrow key// w w w . j a v a 2 s.c o m * Disabled against mobile since tabbing does not make sense on mobile Tabbing with Safari acts oddly. * * @throws Exception */ @ExcludeBrowsers({ BrowserType.SAFARI, BrowserType.ANDROID_PHONE, BrowserType.ANDROID_TABLET, BrowserType.IPHONE, BrowserType.IPAD }) @Test public void testOverflowKeyboardInteractionWithTab() throws Exception { open("/uitest/tabset_Test.cmp?renderItem=overflow"); overflowKeyboardNav(6, true, Keys.ENTER); }
From source file:org.bigtester.ate.model.page.elementaction.SendKeysAction.java
License:Apache License
/** * {@inheritDoc}//www .j a va2 s . co m */ @Override public void doAction(final WebElement webElm) { IStepInputData inputData = getDataValue(); if (null == inputData) { throw new IllegalStateException("inputDatavalue is not correctly populated."); } else { if (inputData.getStrDataValue().equals("[TAB]")) { webElm.sendKeys(Keys.TAB); } else if (inputData.getStrDataValue().equals("[ENTER]")) { webElm.sendKeys(Keys.ENTER); } else { webElm.sendKeys(inputData.getStrDataValue()); } LogbackWriter.writeAppInfo("action tracing: send keys to browser: " + inputData.getStrDataValue()); } }
From source file:org.eclipse.che.selenium.core.action.MacOSActionsTest.java
License:Open Source License
@Test public void testShouldNotReplaceAnyCharSequence() throws Exception { MacOSActions actions = new MacOSActions(webDriver); final CharSequence[] charSequences = actions.modifyCharSequence(Keys.ESCAPE, Keys.ENTER); assertNotNull(charSequences);//from www .j a v a 2 s.c o m assertEquals(charSequences.length, 2); assertEquals(charSequences[0], Keys.ESCAPE); assertEquals(charSequences[1], Keys.ENTER); }
From source file:org.eclipse.che.selenium.debugger.BreakpointReorderingTest.java
License:Open Source License
@Test(priority = 3) public void shouldReorderBreakpointsWhenLineAdded() throws Exception { editor.goToCursorPositionVisible(26, 1); actionsFactory.createAction(seleniumWebDriver).sendKeys(Keys.ENTER).build().perform(); editor.waitInactiveBreakpoint(30);/*from w w w . j a v a 2 s . c om*/ editor.waitInactiveBreakpoint(32); editor.waitInactiveBreakpoint(39); actionsFactory.createAction(seleniumWebDriver).keyDown(Keys.CONTROL).sendKeys("z").keyUp(Keys.CONTROL) .perform(); editor.waitInactiveBreakpoint(29); editor.waitInactiveBreakpoint(31); editor.waitInactiveBreakpoint(38); }
From source file:org.eclipse.che.selenium.editor.autocomplete.AutocompleteFeaturesInEditorTest.java
License:Open Source License
@Test public void createJavaSpringProjectAndTestEditor() { projectExplorer.waitProjectExplorer(); projectExplorer.waitItem(PROJECT_NAME); notificationsPopupPanel.waitProgressPopupPanelClose(); projectExplorer.quickExpandWithJavaScript(); projectExplorer.openItemByVisibleNameInExplorer("AppController.java"); loader.waitOnClosed();//from w w w . j av a2 s.c o m reparseEditorCode(); editor.setCursorToLine(37); editor.typeTextIntoEditor(Keys.END.toString()); editor.typeTextIntoEditor(Keys.ENTER.toString()); editor.launchAutocompleteAndWaitContainer(); String textFromEditorAfterFirstCall = editor.getAllVisibleTextFromAutocomplete(); for (String content : autocompleteContentAfterFirst) { assertTrue(textFromEditorAfterFirstCall.contains(content)); } editor.enterAutocompleteProposal("result : String"); projectExplorer.openItemByVisibleNameInExplorer("AppController.java"); editor.waitTextIntoEditor("result"); editor.typeTextIntoEditor("."); editor.launchAutocompleteAndWaitContainer(); String textFromEditorAfterSecondCall = editor.getAllVisibleTextFromAutocomplete(); for (String content : autocompleteContentAfterSecond) { assertTrue(textFromEditorAfterSecondCall.contains(content)); } editor.enterAutocompleteProposal("getBytes() : byte[]"); editor.typeTextIntoEditor("."); editor.launchAutocompleteAndWaitContainer(); editor.enterAutocompleteProposal("toString() : String"); editor.typeTextIntoEditor(";"); consoles.closeProcessesArea(); editor.waitTextIntoEditor(contentAfterEditing); editor.waitTabFileWithSavedStatus("AppController"); }
From source file:org.eclipse.che.selenium.editor.autocomplete.AutocompleteJSFilesTest.java
License:Open Source License
@Test public void checkAutocompleteJSFilesTest() { projectExplorer.waitItem(PROJECT_NAME); projectExplorer.openItemByPath(PROJECT_NAME); notificationsPopupPanel.waitProgressPopupPanelClose(); projectExplorer.waitProjectExplorer(); projectExplorer.quickExpandWithJavaScript(); menu.runCommand(TestMenuCommandsConstants.Project.PROJECT, TestMenuCommandsConstants.Project.New.NEW, TestMenuCommandsConstants.Project.New.JAVASCRIPT_FILE); askForValueDialog.typeAndWaitText("newJsFile"); askForValueDialog.clickOkBtn();//from www . j a v a 2s . com loader.waitOnClosed(); projectExplorer.waitItemInVisibleArea("newJsFile.js"); editor.waitActiveEditor(); loader.waitOnClosed(); editor.setCursorToLine(1); editor.typeTextIntoEditorWithoutDelayForSaving("function a ("); editor.typeTextIntoEditorWithoutDelayForSaving(Keys.END.toString()); editor.typeTextIntoEditorWithoutDelayForSaving("{"); editor.typeTextIntoEditorWithoutDelayForSaving(Keys.ENTER.toString()); editor.typeTextIntoEditorWithoutDelayForSaving("var b = 5;"); editor.typeTextIntoEditorWithoutDelayForSaving(Keys.ENTER.toString()); editor.typeTextIntoEditorWithoutDelayForSaving("var c = "); editor.launchPropositionAssistPanelForJSFiles(); editor.enterTextIntoFixErrorPropByEnterForJsFiles("b", " : number"); editor.typeTextIntoEditorWithoutDelayForSaving(";"); editor.typeTextIntoEditorWithoutDelayForSaving(Keys.ENTER.toString()); editor.typeTextIntoEditorWithoutDelayForSaving("return c;"); editor.setCursorToLine(5); editor.typeTextIntoEditorWithoutDelayForSaving(Keys.END.toString()); editor.typeTextIntoEditorWithoutDelayForSaving(Keys.ENTER.toString()); editor.launchPropositionAssistPanelForJSFiles(); editor.enterTextIntoFixErrorPropByEnterForJsFiles("a()", " : number"); editor.typeTextIntoEditorWithoutDelayForSaving(";"); editor.typeTextIntoEditorWithoutDelayForSaving(Keys.ENTER.toString()); editor.typeTextIntoEditorWithoutDelayForSaving("/**"); editor.typeTextIntoEditorWithoutDelayForSaving(Keys.ENTER.toString()); Assert.assertEquals(editor.getVisibleTextFromEditor(), EXPECTED_TEXT); editor.setCursorToLine(9); editor.typeTextIntoEditorWithoutDelayForSaving(Keys.END.toString()); editor.typeTextIntoEditorWithoutDelayForSaving(Keys.ENTER.toString()); editor.typeTextIntoEditorWithoutDelayForSaving("function f ("); editor.typeTextIntoEditorWithoutDelayForSaving(Keys.END.toString()); editor.typeTextIntoEditorWithoutDelayForSaving("{"); editor.typeTextIntoEditorWithoutDelayForSaving(Keys.ENTER.toString()); editor.typeTextIntoEditorWithoutDelayForSaving("return 'test text';"); editor.setCursorToLine(12); editor.typeTextIntoEditorWithoutDelayForSaving(Keys.END.toString()); editor.typeTextIntoEditorWithoutDelayForSaving(Keys.ENTER.toString()); editor.launchPropositionAssistPanelForJSFiles(); editor.enterTextIntoFixErrorPropByEnterForJsFiles("f()", " : string"); editor.typeTextIntoEditorWithoutDelayForSaving(";"); editor.typeTextIntoEditorWithoutDelayForSaving(Keys.ENTER.toString()); editor.setCursorToLine(11); editor.typeTextIntoEditorWithoutDelayForSaving(Keys.END.toString()); editor.typeTextIntoEditorWithoutDelayForSaving(Keys.BACK_SPACE.toString()); editor.waitMarkerInPositionAndClick(INFO_MARKER, 11); editor.clickOnElementByXpath("//button[text()='Add missing semicolon']"); editor.waitAllMarkersDisappear(INFO_MARKER); loader.waitOnClosed(); }
From source file:org.eclipse.che.selenium.editor.autocomplete.CheckAutocompleteFeaturesInTheTestFolderTest.java
License:Open Source License
private void checkAutocompletion() { editor.returnFocusInCurrentLine();/*w w w . ja v a2 s . c om*/ editor.setCursorToDefinedLineAndChar(29, 25); editor.typeTextIntoEditor(Keys.ENTER.toString()); editor.waitSpecifiedValueForLineAndChar(30, 9); editor.typeTextIntoEditor("Test"); editor.launchAutocomplete(); String[] autocompleteItems = { "Test", "TestSuite", "TestCollector", "TestListener", "TestFailure" }; for (String autocompleteItem : autocompleteItems) { editor.waitTextIntoAutocompleteContainer(autocompleteItem); } editor.enterAutocompleteProposal("TestCase"); editor.waitTextIntoEditor(" public AppTest(String testName) {\n" + " super(testName);\n" + " TestCase\n" + " }"); editor.typeTextIntoEditor(" testCase;"); }
From source file:org.eclipse.che.selenium.editor.autocomplete.InheritClassTest.java
License:Open Source License
@Test public void autoCompleteClassInTheSamePackage() { //create java class in the same package with GreetingController.java projectExplorer.waitProjectExplorer(); projectExplorer.waitItem(PROJECT_NAME); notificationsPopupPanel.waitProgressPopupPanelClose(); loader.waitOnClosed();/*from w w w.ja va 2 s . c o m*/ projectExplorer.quickExpandWithJavaScript(); loader.waitOnClosed(); projectExplorer.openItemByPath(COMMON_PACKAGE + "/AppController.java"); //create java class in the different package with GreetingController.java projectExplorer.waitProjectExplorer(); projectExplorer.selectItem(COMMON_PACKAGE); menu.runCommand(TestMenuCommandsConstants.Project.PROJECT, TestMenuCommandsConstants.Project.New.NEW, TestMenuCommandsConstants.Project.New.JAVA_CLASS); askForValueDialog.createJavaFileByNameAndType("CodenvyTest", AskForValueDialog.JavaFiles.CLASS); editor.waitTabIsPresent("CodenvyTest"); loader.waitOnClosed(); projectExplorer.selectItem(COMMON_PACKAGE); menu.runCommand(TestMenuCommandsConstants.Project.PROJECT, TestMenuCommandsConstants.Project.New.NEW, TestMenuCommandsConstants.Project.New.JAVA_CLASS); askForValueDialog.createJavaFileByNameAndType("CodenvyTestInherite", AskForValueDialog.JavaFiles.CLASS); editor.waitTabIsPresent("CodenvyTestInherite"); loader.waitOnClosed(); editor.waitActiveEditor(); editor.setCursorToLine(3); editor.typeTextIntoEditor(Keys.END.toString()); editor.typeTextIntoEditor(Keys.ARROW_LEFT.toString()); editor.typeTextIntoEditor("ex"); loader.waitOnClosed(); editor.launchAutocomplete(); editor.waitAutocompleteContainerIsClosed(); editor.waitTextIntoEditor("extends"); editor.typeTextIntoEditor(" Code"); loader.waitOnClosed(); editor.launchAutocompleteAndWaitContainer(); editor.waitTextIntoAutocompleteContainer("CodenvyTest - org.eclipse.qa.examples"); editor.enterAutocompleteProposal("CodenvyTest"); editor.waitAutocompleteContainerIsClosed(); editor.waitTextIntoEditor("CodenvyTestInherite extends CodenvyTest"); loader.waitOnClosed(); editor.waitActiveEditor(); editor.selectTabByName("AppController"); editor.waitActiveEditor(); editor.setCursorToLine(32); editor.typeTextIntoEditor("Code"); editor.launchAutocompleteAndWaitContainer(); editor.waitTextIntoAutocompleteContainer("CodenvyTest - org.eclipse.qa.examples"); editor.waitTextIntoAutocompleteContainer("CodenvyTestInherite - org.eclipse.qa.examples"); editor.enterAutocompleteProposal("CodenvyTest"); editor.waitAutocompleteContainerIsClosed(); editor.waitTextIntoEditor("CodenvyTest"); editor.typeTextIntoEditor(" codenvyTest = n"); editor.launchAutocompleteAndWaitContainer(); editor.waitAutocompleteContainer(); editor.waitTextIntoAutocompleteContainer("new"); editor.typeTextIntoEditor(Keys.ENTER.toString()); editor.typeTextIntoEditor(" Code"); editor.waitCodeAssistMarkers(ERROR_MARKER); editor.launchAutocompleteAndWaitContainer(); editor.waitTextIntoAutocompleteContainer("CodenvyTest - org.eclipse.qa.examples"); editor.waitTextIntoAutocompleteContainer("CodenvyTestInherite - org.eclipse.qa.examples"); editor.enterAutocompleteProposal("CodenvyTestInherite"); editor.waitAutocompleteContainerIsClosed(); editor.typeTextIntoEditor(";"); editor.waitTextIntoEditor("CodenvyTest codenvyTest = numGuessByUser CodenvyTestInherite; \n"); }