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.eclipse.che.selenium.pageobject.GoogleLogin.java
License:Open Source License
/** type into password field on Google authorization page user - defined password */ public void typePasswordDefinedByUser(String password) { new WebDriverWait(seleniumWebDriver, 10).until(ExpectedConditions.visibilityOf(passwordInput)) .sendKeys(password);/*from ww w. ja v a2s. c o m*/ passwordInput.sendKeys(Keys.ENTER.toString()); }
From source file:org.eclipse.che.selenium.pageobject.intelligent.CommandsPalette.java
License:Open Source License
public void clearSearchField() { redrawUiElementTimeout.until(ExpectedConditions.visibilityOf(searchField)).clear(); redrawUiElementTimeout.until(ExpectedConditions.visibilityOf(searchField)).sendKeys(Keys.ENTER); loader.waitOnClosed();/* w w w. j a v a 2 s.co m*/ }
From source file:org.eclipse.che.selenium.pageobject.intelligent.CommandsPalette.java
License:Open Source License
/** * Start the command by pressing Enter key * * @param commandName name of the command *///from w w w. ja va 2 s .co m public void startCommandByEnterKey(String commandName) { String locatorToCurrentCommand = format(Locators.COMMANDS, commandName); WebElement currentCommand = redrawUiElementTimeout .until(ExpectedConditions.visibilityOfElementLocated(By.xpath(locatorToCurrentCommand))); seleniumWebDriver.findElement(By.xpath(locatorToCurrentCommand)).click(); actionsFactory.createAction(seleniumWebDriver).sendKeys(currentCommand, Keys.ENTER.toString()).perform(); redrawUiElementTimeout .until(ExpectedConditions.invisibilityOfElementLocated(By.xpath(locatorToCurrentCommand))); }
From source file:org.eclipse.che.selenium.pageobject.intelligent.CommandsPalette.java
License:Open Source License
/** * Search and start command by name/*www.j a v a 2 s. c o m*/ * * @param mt where to move(down or up) * @param steps */ public void moveAndStartCommand(MoveTypes mt, int steps) { Keys k = mt.equals(MoveTypes.UP) ? Keys.ARROW_UP : Keys.ARROW_DOWN; for (int i = 0; i < steps; i++) { actionsFactory.createAction(seleniumWebDriver).sendKeys(k.toString()).perform(); loader.waitOnClosed(); } actionsFactory.createAction(seleniumWebDriver).sendKeys(Keys.ENTER.toString()).perform(); }
From source file:org.eclipse.che.selenium.plainjava.ConfigureSomeSourceFoldersTest.java
License:Open Source License
@Test public void checkConfigureClasspathPlainJavaProject() { projectExplorer.waitProjectExplorer(); projectExplorer.waitItem(PROJECT_NAME); projectExplorer.openItemByPath(PROJECT_NAME); projectExplorer.openContextMenuByPathSelectedItem(PROJECT_NAME + "/source"); projectExplorer.clickOnItemInContextMenu(TestProjectExplorerContextMenuConstants.BUILD_PATH); projectExplorer.clickOnItemInContextMenu( TestProjectExplorerContextMenuConstants.SubMenuBuildPath.USE_AS_SOURCE_FOLDER); projectExplorer.waitFolderDefinedTypeOfFolderByPath(PROJECT_NAME + "/source", ProjectExplorer.FolderTypes.JAVA_SOURCE_FOLDER); projectExplorer.waitFolderDefinedTypeOfFolderByPath(PROJECT_NAME + "/src", ProjectExplorer.FolderTypes.JAVA_SOURCE_FOLDER); projectExplorer.openContextMenuByPathSelectedItem(PROJECT_NAME + "/source"); createNewJavaClass(newJavaClassName); projectExplorer.waitItem(PROJECT_NAME + "/source/" + newJavaClassName + ".java"); codenvyEditor.waitTextIntoEditor("public class NewClass {"); codenvyEditor.waitAllMarkersDisappear(ERROR_MARKER); codenvyEditor.setCursorToDefinedLineAndChar(2, 24); codenvyEditor.typeTextIntoEditor(Keys.ENTER.toString()); String methodForChecking = " public static String typeCheckMess(){\n" + " return \"Message from source folder\";\n" + " "; codenvyEditor.typeTextIntoEditor(methodForChecking); codenvyEditor.waitAllMarkersDisappear(ERROR_MARKER); projectExplorer.openItemByPath(PROJECT_NAME + "/src"); projectExplorer.waitItem(PROJECT_NAME + "/src/Main.java"); projectExplorer.openItemByPath(PROJECT_NAME + "/src/Main.java"); codenvyEditor.waitTabFileWithSavedStatus("Main"); launchMainClassFromCommandWidget();/*from www .j av a 2 s. co m*/ consoles.waitExpectedTextIntoConsole("Message from source", 15); }
From source file:org.eclipse.che.selenium.plainjava.PlainJavaProjectConfigureClasspathTest.java
License:Open Source License
@Test public void checkConfigureClasspathPlainJavaProject() { projectExplorer.waitProjectExplorer(); projectExplorer.waitItem(PROJECT_NAME); projectExplorer.waitItem(LIB_PROJECT); projectExplorer.openItemByPath(PROJECT_NAME); projectExplorer.waitItem(PROJECT_NAME + "/bin"); projectExplorer.waitItem(PROJECT_NAME + "/src"); projectExplorer.waitItem(PROJECT_NAME + "/test"); // check build path to the subfolder 'java' from context menu projectExplorer.openItemByPath(PROJECT_NAME + "/test"); projectExplorer.openItemByPath(PROJECT_NAME + "/test/java"); projectExplorer.openItemByPath(PROJECT_NAME + "/test/java/com"); projectExplorer.openItemByPath(PROJECT_NAME + "/test/java/com/company"); projectExplorer.selectItem(PROJECT_NAME + "/test/java"); projectExplorer.openContextMenuByPathSelectedItem(PROJECT_NAME + "/test/java"); projectExplorer.clickOnItemInContextMenu(BUILD_PATH); projectExplorer.clickOnItemInContextMenu(USE_AS_SOURCE_FOLDER); projectExplorer.waitItem(PROJECT_NAME + "/test/java/com/company"); projectExplorer.selectItem(PROJECT_NAME + "/test/java"); projectExplorer.openContextMenuByPathSelectedItem(PROJECT_NAME + "/test/java"); projectExplorer.clickOnItemInContextMenu(BUILD_PATH); loader.waitOnClosed();/*from w ww. j a va2 s .c o m*/ projectExplorer.clickOnItemInContextMenu(UNMARK_AS_SOURCE_FOLDER); projectExplorer.waitDisappearItemByPath(PROJECT_NAME + "/test/java/com/company"); // check build path to the folder 'test' from context menu projectExplorer.selectItem(PROJECT_NAME + "/test"); projectExplorer.openContextMenuByPathSelectedItem(PROJECT_NAME + "/test"); projectExplorer.clickOnItemInContextMenu(BUILD_PATH); projectExplorer.clickOnItemInContextMenu(USE_AS_SOURCE_FOLDER); projectExplorer.waitItem(PROJECT_NAME + "/test/java/com/company"); projectExplorer.selectItem(PROJECT_NAME + "/test"); projectExplorer.openContextMenuByPathSelectedItem(PROJECT_NAME + "/test"); projectExplorer.clickOnItemInContextMenu(BUILD_PATH); loader.waitOnClosed(); projectExplorer.clickOnItemInContextMenu(UNMARK_AS_SOURCE_FOLDER); projectExplorer.waitDisappearItemByPath(PROJECT_NAME + "/test/java/com/company"); // check the 'Cancel' button of the 'Select Path' form projectExplorer.selectItem(PROJECT_NAME); menu.runCommand(TestMenuCommandsConstants.Project.PROJECT, TestMenuCommandsConstants.Project.CONFIGURE_CLASSPATH); configureClasspath.waitConfigureClasspathFormIsOpen(); configureClasspath.selectSourceCategory(); configureClasspath.addJarOrFolderToBuildPath(ConfigureClasspath.ADD_FOLDER); configureClasspath.waitSelectPathFormIsOpen(); configureClasspath.clickCancelBtnSelectPathForm(); // check adding and deleting of a source folder configureClasspath.waitExpectedTextJarsAndFolderArea("/" + PROJECT_NAME + "/src"); configureClasspath.addJarOrFolderToBuildPath(ConfigureClasspath.ADD_FOLDER); configureClasspath.waitSelectPathFormIsOpen(); configureClasspath.openItemInSelectPathForm(PROJECT_NAME); configureClasspath.waitItemInSelectPathForm("bin"); configureClasspath.waitItemInSelectPathForm("src"); configureClasspath.waitItemInSelectPathForm("test"); configureClasspath.selectItemInSelectPathForm("test"); configureClasspath.clickOkBtnSelectPathForm(); configureClasspath.waitExpectedTextJarsAndFolderArea("/" + PROJECT_NAME + "/test"); configureClasspath.clickOnDoneBtnConfigureClasspath(); projectExplorer.waitItem(PROJECT_NAME + "/test/java/com/company"); projectExplorer.selectItem(PROJECT_NAME); projectExplorer.openContextMenuByPathSelectedItem(PROJECT_NAME); projectExplorer.clickOnItemInContextMenu(BUILD_PATH); projectExplorer.clickOnItemInContextMenu(CONFIGURE_CLASSPATH); configureClasspath.waitConfigureClasspathFormIsOpen(); configureClasspath.selectSourceCategory(); configureClasspath.deleteJarOrFolderFromBuildPath("/" + PROJECT_NAME + "/test"); configureClasspath.waitExpectedTextIsNotPresentInJarsAndFolderArea("/" + PROJECT_NAME + "/test"); configureClasspath.clickOnDoneBtnConfigureClasspath(); projectExplorer.openItemByPath(PROJECT_NAME + "/test"); projectExplorer.waitDisappearItemByPath(PROJECT_NAME + "/test/java/com/company"); // check the library container projectExplorer.selectItem(PROJECT_NAME); menu.runCommand(PROJECT, CONFIGURE_CLASSPATH); configureClasspath.waitConfigureClasspathFormIsOpen(); configureClasspath.clickLibraryContainer("org.eclipse.jdt.launching.JRE_CONTAINER"); for (String jarName : listJar) { Assert.assertTrue(configureClasspath.getTextFromJarsAndFolderArea().contains(jarName)); } configureClasspath.clickLibraryContainer("org.eclipse.jdt.launching.JRE_CONTAINER"); configureClasspath.waitExpectedTextIsNotPresentInJarsAndFolderArea("rt.jar - /opt/jdk1.8.0_45/jre/lib"); // check adding jar file configureClasspath.addJarOrFolderToBuildPath(ConfigureClasspath.ADD_JAR); configureClasspath.waitSelectPathFormIsOpen(); configureClasspath.openItemInSelectPathForm(LIB_PROJECT); configureClasspath.selectItemInSelectPathForm("log4j-1.2.17.jar"); configureClasspath.clickOkBtnSelectPathForm(); configureClasspath.waitExpectedTextJarsAndFolderArea("log4j-1.2.17.jar - /projects/lib"); configureClasspath.deleteJarOrFolderFromBuildPath("log4j-1.2.17.jar - /projects/lib"); configureClasspath.waitExpectedTextIsNotPresentInJarsAndFolderArea("log4j-1.2.17.jar - /projects/lib"); configureClasspath.addJarOrFolderToBuildPath(ConfigureClasspath.ADD_JAR); configureClasspath.waitSelectPathFormIsOpen(); configureClasspath.openItemInSelectPathForm(LIB_PROJECT); configureClasspath.selectItemInSelectPathForm("mockito-all-1.9.5.jar"); configureClasspath.clickOkBtnSelectPathForm(); configureClasspath.waitExpectedTextJarsAndFolderArea("mockito-all-1.9.5.jar - /projects/lib"); configureClasspath.clickOnDoneBtnConfigureClasspath(); projectExplorer.openItemByPath(PROJECT_NAME + "/src"); projectExplorer.openItemByPath(PROJECT_NAME + "/src/com/company"); projectExplorer.openItemByPath(PROJECT_NAME + "/src/com/company/Main.java"); codenvyEditor.waitActiveEditor(); codenvyEditor.setCursorToLine(17); codenvyEditor.typeTextIntoEditor(Keys.ENTER.toString()); loader.waitOnClosed(); codenvyEditor.setCursorToLine(17); codenvyEditor.typeTextIntoEditor(Keys.TAB.toString()); codenvyEditor.typeTextIntoEditor("Mockito mockito = new Mockito();"); codenvyEditor.waitTextIntoEditor("Mockito mockito = new Mockito();"); codenvyEditor.waitMarkerInPosition(ERROR_MARKER, 17); codenvyEditor.launchPropositionAssistPanel(); codenvyEditor.enterTextIntoFixErrorPropByDoubleClick("Import 'Mockito' (org.mockito)"); codenvyEditor.waitErrorPropositionPanelClosed(); codenvyEditor.waitTextIntoEditor("import org.mockito.Mockito;"); codenvyEditor.setCursorToLine(19); codenvyEditor.waitMarkerDisappears(ERROR_MARKER, 19); }
From source file:org.eclipse.che.selenium.preferences.CheckErrorsWarningsTabTest.java
License:Open Source License
private void changeAllSettingsInErrorsWarningsTab( Preferences.DropDownValueForErrorWaitingWidget valueOfRadioButton) { preferences.waitPreferencesForm();//from ww w. ja v a 2s . c om preferences.waitMenuInCollapsedDropdown(Preferences.DropDownJavaCompilerMenu.ERRORS_WARNINGS); preferences.selectDroppedMenuByName(Preferences.DropDownJavaCompilerMenu.ERRORS_WARNINGS); preferences.setAllSettingsInErrorWaitingWidget(valueOfRadioButton); preferences.clickOnOkBtn(); preferences.clickOnCloseBtn(); loader.waitOnClosed(); projectExplorer.waitItem(PATH_TO_CLASS_IN_SPRING_PACKAGE); projectExplorer.openItemByPath(PATH_TO_CLASS_IN_SPRING_PACKAGE); loader.waitOnClosed(); editor.setCursorToLine(84); editor.typeTextIntoEditor(Keys.END.toString()); editor.typeTextIntoEditor(Keys.ENTER.toString()); editor.typeTextIntoEditorWithoutDelayForSaving(Keys.ARROW_LEFT.toString()); editor.typeTextIntoEditorWithoutDelayForSaving(Keys.ENTER.toString()); editor.typeTextIntoEditor(Keys.DELETE.toString()); editor.typeTextIntoEditor(Keys.DELETE.toString()); WaitUtils.sleepQuietly(3); }
From source file:org.eclipse.che.selenium.projectexplorer.dependencies.UpdateListOfLibraryTest.java
License:Open Source License
private void addNewDependency() { editor.waitActiveEditor();/* ww w. ja v a 2s. c om*/ loader.waitOnClosed(); editor.setCursorToLine(43); editor.typeTextIntoEditor(Keys.END.toString()); editor.typeTextIntoEditor(Keys.ENTER.toString()); editor.typeTextIntoEditorWithoutDelayForSaving("<dependency>"); editor.typeTextIntoEditorWithoutDelayForSaving("\n"); editor.setCursorToLine(45); editor.typeTextIntoEditorWithoutDelayForSaving("<groupId>"); editor.typeTextIntoEditorWithoutDelayForSaving("com.fasterxml.jackson.core"); editor.typeTextIntoEditorWithoutDelayForSaving("</groupId>"); editor.typeTextIntoEditorWithoutDelayForSaving("\n"); editor.setCursorToLine(46); editor.typeTextIntoEditorWithoutDelayForSaving("<artifactId>"); editor.typeTextIntoEditorWithoutDelayForSaving("jackson-core"); editor.typeTextIntoEditorWithoutDelayForSaving("</artifactId>"); editor.typeTextIntoEditorWithoutDelayForSaving("\n"); editor.setCursorToLine(47); editor.typeTextIntoEditorWithoutDelayForSaving("<version>"); editor.typeTextIntoEditorWithoutDelayForSaving("2.4.3"); editor.typeTextIntoEditorWithoutDelayForSaving("</version>"); editor.typeTextIntoEditorWithoutDelayForSaving("\n"); editor.typeTextIntoEditorWithoutDelayForSaving("</dependency>"); editor.typeTextIntoEditor(Keys.SPACE.toString()); }
From source file:org.eclipse.che.selenium.projectexplorer.PreviewHtmlFileTest.java
License:Open Source License
@Test public void checkPreviewHtmlFile() { projectExplorer.waitProjectExplorer(); projectExplorer.waitItem(PROJECT_NAME); currentWindow = ide.driver().getWindowHandle(); projectExplorer.quickExpandWithJavaScript(); projectExplorer.openContextMenuByPathSelectedItem(PROJECT_NAME + "/file.html"); projectExplorer.clickOnItemInContextMenu(TestProjectExplorerContextMenuConstants.PREVIEW); seleniumWebDriver.switchToNoneCurrentWindow(currentWindow); checkWebElementsHtmlFile("//h1[text()='Hello, this is check!']"); ide.driver().close();// w w w.j av a 2s. c om ide.driver().switchTo().window(currentWindow); // type a content into editor and check it by preview feature projectExplorer.waitProjectExplorer(); projectExplorer.waitItem(PROJECT_NAME + "/file.html"); projectExplorer.openItemByPath(PROJECT_NAME + "/file.html"); editor.waitActiveEditor(); editor.setCursorToLine(19); editor.typeTextIntoEditor(Keys.ENTER.toString()); editor.typeTextIntoEditor(Keys.ARROW_UP.toString()); editor.typeTextIntoEditor(H2_CONTENT); editor.waitTextIntoEditor(H2_CONTENT); projectExplorer.openContextMenuByPathSelectedItem(PROJECT_NAME + "/file.html"); projectExplorer.clickOnItemInContextMenu(TestProjectExplorerContextMenuConstants.PREVIEW); seleniumWebDriver.switchToNoneCurrentWindow(currentWindow); checkWebElementsHtmlFile("//h2[@style='color:red' and text()='Test content']"); ide.driver().switchTo().window(currentWindow); editor.setCursorToLine(19); editor.typeTextIntoEditor(Keys.ENTER.toString()); editor.typeTextIntoEditor(Keys.ARROW_UP.toString()); editor.typeTextIntoEditor(BODY_CONTENT); editor.waitTextIntoEditor(BODY_CONTENT); seleniumWebDriver.switchToNoneCurrentWindow(currentWindow); loader.waitOnClosed(); checkWebElementsHtmlFile("//h2[@style='color:red' and text()='Test content']"); loader.waitOnClosed(); ide.driver().navigate().refresh(); checkWebElementsHtmlFile("//b[text()='Content of file']"); }
From source file:org.eclipse.che.selenium.refactor.fields.RenameNotPrivateFieldTest.java
License:Open Source License
@Test public void checkRenameNotPrivateField0() throws Exception { setFieldsForTest("test0"); projectExplorer.scrollAndselectItem(pathToCurrentPackage); projectExplorer.openItemByPath(pathToCurrentPackage); projectExplorer.waitVisibleItem(pathToCurrentPackage + "/A.java"); projectExplorer.sendToItemDownArrowKey(); projectExplorer.sendToItemEnterKey(); editor.waitActiveEditor();//from w w w . ja v a 2 s. c o m editor.waitTextIntoEditor(contentFromInA); loader.waitOnClosed(); editor.setCursorToLine(21); editor.typeTextIntoEditor(Keys.END.toString()); editor.typeTextIntoEditor(Keys.ARROW_LEFT.toString()); editor.launchRefactorFormFromEditor(); editor.typeTextIntoEditor("g"); loader.waitOnClosed(); editor.typeTextIntoEditor(Keys.ENTER.toString()); editor.waitTextIntoEditor(contentFromOutA); editor.closeFileByNameWithSaving("A"); }