Example usage for org.openqa.selenium Keys SPACE

List of usage examples for org.openqa.selenium Keys SPACE

Introduction

In this page you can find the example usage for org.openqa.selenium Keys SPACE.

Prototype

Keys SPACE

To view the source code for org.openqa.selenium Keys SPACE.

Click Source Link

Usage

From source file:org.eclipse.che.selenium.editor.SplitEditorFeatureTest.java

License:Open Source License

@Test(priority = 2)
public void checkRefactoring() {
    editor.selectTabByIndexEditorWindow(2, NAME_JAVA_CLASS);
    editor.waitActiveEditor();//from   ww w.j  av  a  2 s  . com
    projectExplorer.selectItem(PATH_JAVA_FILE);
    projectExplorer.launchRefactorByKeyboard();
    refactor.typeAndWaitNewName(NEW_NAME_JAVA);
    refactor.sendKeysIntoField(Keys.SPACE.toString());
    refactor.sendKeysIntoField(Keys.BACK_SPACE.toString());
    refactor.clickOkButtonRefactorForm();
    editor.waitActiveEditor();
    editor.selectTabByIndexEditorWindow(1, NEW_NAME);
    editor.waitActiveEditor();
    editor.selectTabByIndexEditorWindow(0, NEW_NAME);
    editor.waitActiveEditor();
    editor.setCursorToLine(2);
    editor.typeTextIntoEditor("//" + TEXT);
    editor.waitTextIntoEditor("//" + TEXT);
    editor.selectTabByIndexEditorWindow(1, NEW_NAME);
    editor.waitActiveEditor();
    editor.waitTextIntoEditor("//" + TEXT);
    editor.selectTabByIndexEditorWindow(2, NEW_NAME);
    editor.waitActiveEditor();
    editor.waitTextIntoEditor("//" + TEXT);
}

From source file:org.eclipse.che.selenium.git.GitColorsTest.java

License:Open Source License

@Test(priority = 4)
public void testFileColorsAfterCommitFromMenu() {
    // Make a change
    editor.selectTabByName("README.md");
    editor.typeTextIntoEditor("//change" + Keys.SPACE);
    editor.waitTabFileWithSavedStatus("README.md");

    // check that the file color is blue
    projectExplorer.waitBlueNode(PROJECT_NAME + "/README.md");
    editor.waitBlueTab("README.md");

    // Perform commit
    projectExplorer.waitAndSelectItem(PROJECT_NAME);
    menu.runCommand(GIT, TestMenuCommandsConstants.Git.COMMIT);
    git.waitAndRunCommit("commit");
    git.waitCommitFormClosed();/*  w  w w  .j  a v a2 s .  com*/

    // Check files are colored in default color
    projectExplorer.waitDefaultColorNode(PROJECT_NAME + "/newFile");
    projectExplorer.waitDefaultColorNode(PROJECT_NAME + "/README.md");
    editor.waitDefaultColorTab("newFile");
    editor.waitDefaultColorTab("README.md");
}

From source file:org.eclipse.che.selenium.intelligencecommand.MacrosCommandsEditorTest.java

License:Open Source License

@Test(priority = 1)
public void checkCommandMacrosIntoCommandLine() {
    projectExplorer.waitProjectExplorer();
    projectExplorer.waitItem(PROJ_NAME);
    projectExplorer.quickExpandWithJavaScript();
    projectExplorer.waitItem(PATH_TO_FILE);
    projectExplorer.openItemByPath(PATH_TO_FILE);
    createNewJavaCommand();/* www.j  ava 2 s .  c o  m*/
    commandsEditor.selectMacrosLinkInCommandsEditor(EDITOR_MACROS_LINK);
    commandsEditor.cancelFormInEditorByEscape();
    commandsEditor.waitCommandsMacrosIsClosed();
    commandsEditor.setFocusIntoTypeCommandsEditor(COMMAND_LINE_EDITOR);
    commandsEditor.setCursorToLine(1);
    commandsEditor.typeTextIntoEditor(Keys.ENTER.toString());
    commandsEditor.typeTextIntoEditor(Keys.ARROW_UP.toString());
    commandsEditor.waitActiveEditor();
    commandsEditor.typeTextIntoEditor("echo ");
    commandsEditor.selectMacrosLinkInCommandsEditor(EDITOR_MACROS_LINK);
    commandsEditor.typeTextIntoSearchMacroField("rel");
    commandsEditor.waitTextIntoSearchMacroField("rel");
    String[] macrosItems = { "${current.project.relpath}", "${editor.current.file.relpath}",
            "${explorer.current.file.relpath}",
            "Path relative to the /projects folder to the selected file in editor",
            "Path relative to the /projects folder in project tree" };
    for (String macrosItem : macrosItems) {
        commandsEditor.waitTextIntoMacrosContainer(macrosItem);
    }
    commandsEditor.enterMacroCommandByEnter("${explorer.current.file.relpath}");
    commandsEditor.waitTextIntoEditor("echo ${explorer.current.file.relpath}");
    commandsEditor.clickOnRunButton();
    consoles.waitExpectedTextIntoConsole("/" + PROJ_NAME + "/src/Main.java");
    commandsEditor.setCursorToLine(1);
    commandsEditor.selectLineAndDelete();
    commandsEditor.waitActiveEditor();
    commandsEditor.typeTextIntoEditor("echo ");
    commandsEditor.selectMacrosLinkInCommandsEditor(EDITOR_MACROS_LINK);
    commandsEditor.selectMacroCommand("${current.class.fqn}");
    commandsEditor.typeTextIntoEditor(Keys.ARROW_DOWN.toString());
    commandsEditor.typeTextIntoEditor(Keys.SPACE.toString());
    commandsEditor.waitMacroCommandIsSelected("${current.project.path}");
    commandsEditor.enterMacroCommandByDoubleClick("${current.project.path}");
    commandsEditor.waitTextIntoEditor("echo ${current.project.path}");
    commandsEditor.clickOnRunButton();
    consoles.waitExpectedTextIntoConsole("/projects/" + PROJ_NAME);
}

From source file:org.eclipse.che.selenium.intelligencecommand.MacrosCommandsEditorTest.java

License:Open Source License

@Test(priority = 2)
public void checkCommandMacrosIntoPreviewUrl() {
    commandsEditor.cancelFormInEditorByEscape();
    commandsEditor.setFocusIntoTypeCommandsEditor(PREVIEW_URL_EDITOR);
    commandsEditor.setCursorToLine(1);/*ww w  . j  a  v  a  2 s  .  c  om*/
    commandsEditor.waitActiveEditor();
    commandsEditor.selectMacrosLinkInCommandsEditor(PREVIEW_MACROS_LINK);
    commandsEditor.typeTextIntoSearchMacroField("server.22/");
    commandsEditor.waitTextIntoSearchMacroField("server.22/");
    String[] macrosItems = { "${server.22/tcp.hostname}", "${server.22/tcp.port}", "${server.22/tcp.protocol}",
            "${server.22/tcp}", "Returns hostname of a server registered by name",
            "Returns port of a server registered by name", "Returns protocol of a server registered by name",
            "Returns protocol, hostname and port of an internal server" };
    for (String macrosItem : macrosItems) {
        commandsEditor.waitTextIntoMacrosContainer(macrosItem);
    }
    commandsEditor.enterMacroCommandByEnter("${server.22/tcp.hostname}");
    commandsEditor.waitTextIntoEditor("${server.22/tcp.hostname}");
    commandsEditor.clickOnRunButton();
    consoles.waitExpectedTextIntoPreviewUrl("ssh");
    commandsEditor.setFocusIntoTypeCommandsEditor(PREVIEW_URL_EDITOR);
    commandsEditor.setCursorToLine(1);
    commandsEditor.selectLineAndDelete();
    commandsEditor.waitActiveEditor();
    commandsEditor.selectMacrosLinkInCommandsEditor(PREVIEW_MACROS_LINK);
    commandsEditor.selectMacroCommand("${server.22/tcp}");
    commandsEditor.typeTextIntoEditor(Keys.ARROW_UP.toString());
    commandsEditor.typeTextIntoEditor(Keys.SPACE.toString());
    commandsEditor.waitMacroCommandIsSelected("${server.22/tcp.protocol}");
    commandsEditor.enterMacroCommandByDoubleClick("${server.22/tcp.protocol}");
    commandsEditor.waitTextIntoEditor("${server.22/tcp.protocol}");
    commandsEditor.clickOnRunButton();
    consoles.waitExpectedTextIntoPreviewUrl("ssh");
}

From source file:org.eclipse.che.selenium.projectexplorer.dependencies.UpdateListOfLibraryTest.java

License:Open Source License

private void addNewDependency() {
    editor.waitActiveEditor();/*from w w  w  . j  ava2 s .  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.jspringbot.keyword.selenium.SeleniumHelper.java

License:Open Source License

private String mapAsciiKeyCodeToKey(int keyCode) {
    Map<Integer, Keys> keysMap = new HashMap<Integer, Keys>();
    keysMap.put(0, Keys.NULL);/* www  .j a va2 s .c  o m*/
    keysMap.put(8, Keys.BACK_SPACE);
    keysMap.put(9, Keys.TAB);
    keysMap.put(10, Keys.RETURN);
    keysMap.put(13, Keys.ENTER);
    keysMap.put(24, Keys.CANCEL);
    keysMap.put(27, Keys.ESCAPE);
    keysMap.put(32, Keys.SPACE);
    keysMap.put(42, Keys.MULTIPLY);
    keysMap.put(43, Keys.ADD);
    keysMap.put(44, Keys.SUBTRACT);
    keysMap.put(56, Keys.DECIMAL);
    keysMap.put(57, Keys.DIVIDE);
    keysMap.put(59, Keys.SEMICOLON);
    keysMap.put(61, Keys.EQUALS);
    keysMap.put(127, Keys.DELETE);
    Keys key = keysMap.get(keyCode);

    if (key == null) {
        Character c = (char) keyCode;
        return c.toString();
    }

    return key.toString();
}

From source file:org.kuali.rice.krad.demo.uif.library.controls.DemoControlCheckboxDefaultAft.java

License:Educational Community License

protected void testCheckboxControlEvaluateDisabledOnKeyUp() throws Exception {
    navigateToExample("Demo-CheckboxControl-Example7");

    waitForElementPresentById("ST-DemoCheckboxControlExample7-Input1_control");
    waitForElementPresentById("ST-DemoCheckboxControlExample7-Input2_control");
    assertTextPresent("Evaluate the disabled condition on each key up event");

    // check that checkbox controls is visible, not selected and disabled
    assertTrue(isVisibleById("ST-DemoCheckboxControlExample7-Input2_control"));
    assertFalse(isCheckedById("ST-DemoCheckboxControlExample7-Input2_control"));
    assertFalse(isEnabledById("ST-DemoCheckboxControlExample7-Input2_control"));

    // space input1
    driver.findElement(By.id("ST-DemoCheckboxControlExample7-Input1_control")).sendKeys(Keys.SPACE);

    // check that checkbox controls is visible, not selected and enabled
    assertTrue(isVisibleById("ST-DemoCheckboxControlExample7-Input2_control"));
    assertFalse(isCheckedById("ST-DemoCheckboxControlExample7-Input2_control"));
    assertTrue(isEnabledById("ST-DemoCheckboxControlExample7-Input2_control"));
}

From source file:org.mycore.mir.it.controller.MIRModsEditorController.java

public void setOpenAIRE(String searchTrigger, String fullName) {
    WebElement nameElement = driver.waitAndFindElement(By.id("name"));// name should be changed in future
    try { /// fixme: get it to work without sleep
        Thread.sleep(2000);/*from  w  w w  .  j  av a2  s.c  o m*/
        nameElement.clear();
        Thread.sleep(2000);
        nameElement.click();
        Thread.sleep(2000);
        nameElement.sendKeys(searchTrigger);
        Thread.sleep(2000);
        nameElement.sendKeys(Keys.SPACE);
        Thread.sleep(2000);
    } catch (InterruptedException e) {
    }
    nameElement.click();

    driver.waitAndFindElements(By.xpath(".//ul[contains(@class,'typeahead')]/li/a")).stream()
            .filter(e -> e.getText().contains(fullName)).limit(1).forEach(e -> e.click());
}

From source file:org.safs.selenium.webdriver.lib.WDLibrary.java

License:Open Source License

/**
 * Convert a Java KEYCODE to a Selenium WebDriver Keys Enum
 * @param keycode int, a java keycode/*from   w  ww  . ja va2 s  . co  m*/
 * @return Keys enum for (primarily) non-printable (control) characters, or null.
 */
public static Keys convertToKeys(int keycode) {
    Keys key = null;
    switch (keycode) {
    case java.awt.event.KeyEvent.VK_ADD:
        key = Keys.ADD;
        break;
    case java.awt.event.KeyEvent.VK_ALT:
        key = Keys.ALT;
        break;
    case java.awt.event.KeyEvent.VK_KP_DOWN:
        key = Keys.ARROW_DOWN;
        break;
    case java.awt.event.KeyEvent.VK_KP_LEFT:
        key = Keys.ARROW_LEFT;
        break;
    case java.awt.event.KeyEvent.VK_KP_RIGHT:
        key = Keys.ARROW_RIGHT;
        break;
    case java.awt.event.KeyEvent.VK_KP_UP:
        key = Keys.ARROW_UP;
        break;
    case java.awt.event.KeyEvent.VK_BACK_SPACE:
        key = Keys.BACK_SPACE;
        break;
    case java.awt.event.KeyEvent.VK_CANCEL:
        key = Keys.CANCEL;
        break;
    case java.awt.event.KeyEvent.VK_CLEAR:
        key = Keys.CLEAR;
        break;
    case java.awt.event.KeyEvent.VK_WINDOWS:
        key = Keys.COMMAND;
        break;
    case java.awt.event.KeyEvent.VK_CONTROL:
        key = Keys.CONTROL;
        break;
    case java.awt.event.KeyEvent.VK_DECIMAL:
        key = Keys.DECIMAL;
        break;
    case java.awt.event.KeyEvent.VK_DELETE:
        key = Keys.DELETE;
        break;
    case java.awt.event.KeyEvent.VK_DIVIDE:
        key = Keys.DIVIDE;
        break;
    case java.awt.event.KeyEvent.VK_DOWN:
        key = Keys.DOWN;
        break;
    case java.awt.event.KeyEvent.VK_END:
        key = Keys.END;
        break;
    case java.awt.event.KeyEvent.VK_ENTER:
        key = Keys.ENTER;
        break;
    case java.awt.event.KeyEvent.VK_EQUALS:
        key = Keys.EQUALS;
        break;
    case java.awt.event.KeyEvent.VK_ESCAPE:
        key = Keys.ESCAPE;
        break;
    case java.awt.event.KeyEvent.VK_F1:
        key = Keys.F1;
        break;
    case java.awt.event.KeyEvent.VK_F2:
        key = Keys.F2;
        break;
    case java.awt.event.KeyEvent.VK_F3:
        key = Keys.F3;
        break;
    case java.awt.event.KeyEvent.VK_F4:
        key = Keys.F4;
        break;
    case java.awt.event.KeyEvent.VK_F5:
        key = Keys.F5;
        break;
    case java.awt.event.KeyEvent.VK_F6:
        key = Keys.F6;
        break;
    case java.awt.event.KeyEvent.VK_F7:
        key = Keys.F7;
        break;
    case java.awt.event.KeyEvent.VK_F8:
        key = Keys.F8;
        break;
    case java.awt.event.KeyEvent.VK_F9:
        key = Keys.F9;
        break;
    case java.awt.event.KeyEvent.VK_F10:
        key = Keys.F10;
        break;
    case java.awt.event.KeyEvent.VK_F11:
        key = Keys.F11;
        break;
    case java.awt.event.KeyEvent.VK_F12:
        key = Keys.F12;
        break;
    case java.awt.event.KeyEvent.VK_HELP:
        key = Keys.HELP;
        break;
    case java.awt.event.KeyEvent.VK_HOME:
        key = Keys.HOME;
        break;
    case java.awt.event.KeyEvent.VK_INSERT:
        key = Keys.INSERT;
        break;
    case java.awt.event.KeyEvent.VK_LEFT:
        key = Keys.LEFT;
        break;
    case java.awt.event.KeyEvent.VK_META:
        key = Keys.META;
        break;
    case java.awt.event.KeyEvent.VK_MULTIPLY:
        key = Keys.MULTIPLY;
        break;
    case java.awt.event.KeyEvent.VK_NUMPAD0:
        key = Keys.NUMPAD0;
        break;
    case java.awt.event.KeyEvent.VK_NUMPAD1:
        key = Keys.NUMPAD1;
        break;
    case java.awt.event.KeyEvent.VK_NUMPAD2:
        key = Keys.NUMPAD2;
        break;
    case java.awt.event.KeyEvent.VK_NUMPAD3:
        key = Keys.NUMPAD3;
        break;
    case java.awt.event.KeyEvent.VK_NUMPAD4:
        key = Keys.NUMPAD4;
        break;
    case java.awt.event.KeyEvent.VK_NUMPAD5:
        key = Keys.NUMPAD5;
        break;
    case java.awt.event.KeyEvent.VK_NUMPAD6:
        key = Keys.NUMPAD6;
        break;
    case java.awt.event.KeyEvent.VK_NUMPAD7:
        key = Keys.NUMPAD7;
        break;
    case java.awt.event.KeyEvent.VK_NUMPAD8:
        key = Keys.NUMPAD8;
        break;
    case java.awt.event.KeyEvent.VK_NUMPAD9:
        key = Keys.NUMPAD9;
        break;
    case java.awt.event.KeyEvent.VK_PAGE_DOWN:
        key = Keys.PAGE_DOWN;
        break;
    case java.awt.event.KeyEvent.VK_PAGE_UP:
        key = Keys.PAGE_UP;
        break;
    case java.awt.event.KeyEvent.VK_PAUSE:
        key = Keys.PAUSE;
        break;
    case java.awt.event.KeyEvent.VK_RIGHT:
        key = Keys.RIGHT;
        break;
    case java.awt.event.KeyEvent.VK_SEMICOLON:
        key = Keys.SEMICOLON;
        break;
    case java.awt.event.KeyEvent.VK_SEPARATOR:
        key = Keys.SEPARATOR;
        break;
    case java.awt.event.KeyEvent.VK_SHIFT:
        key = Keys.SHIFT;
        break;
    case java.awt.event.KeyEvent.VK_SPACE:
        key = Keys.SPACE;
        break;
    case java.awt.event.KeyEvent.VK_SUBTRACT:
        key = Keys.SUBTRACT;
        break;
    case java.awt.event.KeyEvent.VK_TAB:
        key = Keys.TAB;
        break;
    case java.awt.event.KeyEvent.VK_UP:
        key = Keys.UP;
        break;
    }
    return key;
}

From source file:org.xwiki.test.wysiwyg.MacroTest.java

License:Open Source License

/**
 * Toggles the collapsed state of the currently selected macro.
 */
public void toggleMacroCollapsedState() {
    getRichTextArea().sendKeys(Keys.SPACE);
}