Example usage for org.openqa.selenium Keys F4

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

Introduction

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

Prototype

Keys F4

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

Click Source Link

Usage

From source file:com.opera.core.systems.OperaMobileKeysTest.java

License:Apache License

@Test
public void softKey4MapsToF4() {
    assertEquals(Keys.F4.charAt(0), OperaMobileKeys.SOFT_KEY_4.charAt(0));
}

From source file:com.thoughtworks.selenium.webdriven.commands.SendKeys.java

License:Apache License

@Override
protected Void handleSeleneseCommand(WebDriver driver, String locator, String value) {
    alertOverride.replaceAlertMethod(driver);

    value = value.replace("${KEY_ALT}", Keys.ALT);
    value = value.replace("${KEY_CONTROL}", Keys.CONTROL);
    value = value.replace("${KEY_CTRL}", Keys.CONTROL);
    value = value.replace("${KEY_META}", Keys.META);
    value = value.replace("${KEY_COMMAND}", Keys.COMMAND);
    value = value.replace("${KEY_SHIFT}", Keys.SHIFT);

    value = value.replace("${KEY_BACKSPACE}", Keys.BACK_SPACE);
    value = value.replace("${KEY_BKSP}", Keys.BACK_SPACE);
    value = value.replace("${KEY_DELETE}", Keys.DELETE);
    value = value.replace("${KEY_DEL}", Keys.DELETE);
    value = value.replace("${KEY_ENTER}", Keys.ENTER);
    value = value.replace("${KEY_EQUALS}", Keys.EQUALS);
    value = value.replace("${KEY_ESCAPE}", Keys.ESCAPE);
    value = value.replace("${KEY_ESC}", Keys.ESCAPE);
    value = value.replace("${KEY_INSERT}", Keys.INSERT);
    value = value.replace("${KEY_INS}", Keys.INSERT);
    value = value.replace("${KEY_PAUSE}", Keys.PAUSE);
    value = value.replace("${KEY_SEMICOLON}", Keys.SEMICOLON);
    value = value.replace("${KEY_SPACE}", Keys.SPACE);
    value = value.replace("${KEY_TAB}", Keys.TAB);

    value = value.replace("${KEY_LEFT}", Keys.LEFT);
    value = value.replace("${KEY_UP}", Keys.UP);
    value = value.replace("${KEY_RIGHT}", Keys.RIGHT);
    value = value.replace("${KEY_DOWN}", Keys.DOWN);
    value = value.replace("${KEY_PAGE_UP}", Keys.PAGE_UP);
    value = value.replace("${KEY_PGUP}", Keys.PAGE_UP);
    value = value.replace("${KEY_PAGE_DOWN}", Keys.PAGE_DOWN);
    value = value.replace("${KEY_PGDN}", Keys.PAGE_DOWN);
    value = value.replace("${KEY_END}", Keys.END);
    value = value.replace("${KEY_HOME}", Keys.HOME);

    value = value.replace("${KEY_NUMPAD0}", Keys.NUMPAD0);
    value = value.replace("${KEY_N0}", Keys.NUMPAD0);
    value = value.replace("${KEY_NUMPAD1}", Keys.NUMPAD1);
    value = value.replace("${KEY_N1}", Keys.NUMPAD1);
    value = value.replace("${KEY_NUMPAD2}", Keys.NUMPAD2);
    value = value.replace("${KEY_N2}", Keys.NUMPAD2);
    value = value.replace("${KEY_NUMPAD3}", Keys.NUMPAD3);
    value = value.replace("${KEY_N3}", Keys.NUMPAD3);
    value = value.replace("${KEY_NUMPAD4}", Keys.NUMPAD4);
    value = value.replace("${KEY_N4}", Keys.NUMPAD4);
    value = value.replace("${KEY_NUMPAD5}", Keys.NUMPAD5);
    value = value.replace("${KEY_N5}", Keys.NUMPAD5);
    value = value.replace("${KEY_NUMPAD6}", Keys.NUMPAD6);
    value = value.replace("${KEY_N6}", Keys.NUMPAD6);
    value = value.replace("${KEY_NUMPAD7}", Keys.NUMPAD7);
    value = value.replace("${KEY_N7}", Keys.NUMPAD7);
    value = value.replace("${KEY_NUMPAD8}", Keys.NUMPAD8);
    value = value.replace("${KEY_N8}", Keys.NUMPAD8);
    value = value.replace("${KEY_NUMPAD9}", Keys.NUMPAD9);
    value = value.replace("${KEY_N9}", Keys.NUMPAD9);
    value = value.replace("${KEY_ADD}", Keys.ADD);
    value = value.replace("${KEY_NUM_PLUS}", Keys.ADD);
    value = value.replace("${KEY_DECIMAL}", Keys.DECIMAL);
    value = value.replace("${KEY_NUM_PERIOD}", Keys.DECIMAL);
    value = value.replace("${KEY_DIVIDE}", Keys.DIVIDE);
    value = value.replace("${KEY_NUM_DIVISION}", Keys.DIVIDE);
    value = value.replace("${KEY_MULTIPLY}", Keys.MULTIPLY);
    value = value.replace("${KEY_NUM_MULTIPLY}", Keys.MULTIPLY);
    value = value.replace("${KEY_SEPARATOR}", Keys.SEPARATOR);
    value = value.replace("${KEY_SEP}", Keys.SEPARATOR);
    value = value.replace("${KEY_SUBTRACT}", Keys.SUBTRACT);
    value = value.replace("${KEY_NUM_MINUS}", Keys.SUBTRACT);

    value = value.replace("${KEY_F1}", Keys.F1);
    value = value.replace("${KEY_F2}", Keys.F2);
    value = value.replace("${KEY_F3}", Keys.F3);
    value = value.replace("${KEY_F4}", Keys.F4);
    value = value.replace("${KEY_F5}", Keys.F5);
    value = value.replace("${KEY_F6}", Keys.F6);
    value = value.replace("${KEY_F7}", Keys.F7);
    value = value.replace("${KEY_F8}", Keys.F8);
    value = value.replace("${KEY_F9}", Keys.F9);
    value = value.replace("${KEY_F10}", Keys.F10);
    value = value.replace("${KEY_F11}", Keys.F11);
    value = value.replace("${KEY_F12}", Keys.F12);

    finder.findElement(driver, locator).sendKeys(value);

    return null;// w ww  .  ja v  a2 s. c  o m
}

From source file:org.eclipse.che.selenium.editor.autocomplete.AutocompleteProposalJavaDocTest.java

License:Open Source License

@Test
public void shouldWorkAroundAbsentSourcesOfExternalLib() throws IOException {
    // when//from  w  ww  .j a  v  a 2  s.  c  o m
    editor.waitActiveEditor();
    loader.waitOnClosed();
    editor.setCursorToDefinedLineAndChar(30, 23);
    editor.launchAutocompleteAndWaitContainer();
    editor.selectAutocompleteProposal("info(String arg0) : void");

    // then
    verifyJavaDoc(editor.getAutocompleteProposalJavaDocHtml(), ".*No documentation found.*");

    // when
    editor.closeAutocomplete();
    editor.typeTextIntoEditor(Keys.F4.toString());
    editor.waitActiveTabFileName("Logger"); // there should be class "Logger" opened in decompiled view with "Download sources" link at the top.
    editor.clickOnDownloadSourcesLink(); // there should be "Download sources" link displayed in at the top of editor. Download they.

    editor.selectTabByName(APP_CLASS_NAME);
    loader.waitOnClosed();
    editor.setCursorToDefinedLineAndChar(30, 23);
    editor.launchAutocompleteAndWaitContainer();
    editor.selectAutocompleteProposal("info(String msg) : void");

    // then
    verifyJavaDoc(editor.getAutocompleteProposalJavaDocHtml(), ".*Log a message at the .* level."
            + "<dl><dt>Parameters:</dt>" + "<dd><b>msg</b>" + "  the message string to be logged</dd></dl>.*");
}

From source file:org.eclipse.che.selenium.editor.autocomplete.CheckAutocompleteFeaturesInTheTestFolderTest.java

License:Open Source License

private void checkOpenDeclaration() {
    editor.setCursorToDefinedLineAndChar(35, 21);
    editor.typeTextIntoEditor(Keys.F4.toString());
    editor.waitTabIsPresent("Test");
    String expectedContent = "\n" + " // Failed to get sources. Instead, stub sources have been generated.\n"
            + " // Implementation of methods is unavailable.\n" + "package junit.framework;\n"
            + "public interface Test {\n" + "\n" + "    public int countTestCases();\n" + "\n"
            + "    public void run(junit.framework.TestResult arg0);\n" + "\n" + "}\n";

    editor.waitTextIntoEditor(expectedContent);
    editor.closeFileByNameWithSaving("Test");
}

From source file:org.eclipse.che.selenium.editor.autocomplete.OpenDeclarationTest.java

License:Open Source License

@Test
public void navigateToSourceTest() throws Exception {
    projectExplorer.waitItem(PROJECT_NAME);
    events.clickProjectEventsTab();// www  . j av a  2s  . c  o  m
    mavenPluginStatusBar.waitClosingInfoPanel();
    projectExplorer.quickExpandWithJavaScript();
    projectExplorer.openItemByVisibleNameInExplorer("AppController.java");
    loader.waitOnClosed();
    editor.selectTabByName("AppController");
    editor.setCursorToLine(20);
    editor.typeTextIntoEditor(Keys.ENTER.toString());
    editor.typeTextIntoEditor("import sun.net.spi.nameservice.dns.DNSNameServiceDescriptor;");
    editor.typeTextIntoEditor(Keys.ENTER.toString());
    editor.setCursorToLine(25);
    editor.typeTextIntoEditor(Keys.ENTER.toString());
    editor.typeTextIntoEditor("DNSNameServiceDescriptor descriptor = new DNSNameServiceDescriptor();");
    editor.typeTextIntoEditor(Keys.ENTER.toString());
    editor.typeTextIntoEditor("String sdf = descriptor.getProviderName();");
    editor.typeTextIntoEditor(Keys.ENTER.toString());
    loader.waitOnClosed();

    editor.setCursorToDefinedLineAndChar(26, 10);
    editor.typeTextIntoEditor(Keys.F4.toString());
    editor.waitTabIsPresent("DNSNameServiceDescriptor");
    editor.waitActiveEditor();
    editor.setCursorToLine(5);
    editor.waitTextElementsActiveLine("DNSNameServiceDescriptor");
    editor.closeFileByNameWithSaving("DNSNameServiceDescriptor");
    editor.waitTabIsNotPresent("DNSNameServiceDescriptor");
    editor.selectTabByName("AppController");
    editor.setCursorToDefinedLineAndChar(27, 39);
    editor.typeTextIntoEditor(Keys.F4.toString());
    editor.waitTabIsPresent("DNSNameServiceDescriptor");
    editor.setCursorToLine(11);
    editor.waitTextElementsActiveLine("getProviderName");
    editor.closeFileByNameWithSaving("DNSNameServiceDescriptor");

    // check an ability to download source
    editor.selectTabByName("AppController");
    editor.setCursorToDefinedLineAndChar(30, 12);
    editor.typeTextIntoEditor(Keys.F4.toString());
    editor.waitTabIsPresent("ModelAndView");
    //editor.waitTextIntoEditor(expectedTextBeforeDownloadSources);
    editor.clickOnDownloadSourcesLink();
    loader.waitOnClosed();
    //editor.waitTextIntoEditor(expectedTextAfterDownloadSources);

    editor.closeFileByNameWithSaving("ModelAndView");

    // check go to class
    editor.selectTabByName("AppController");
    editor.setCursorToDefinedLineAndChar(30, 12);
    editor.typeTextIntoEditor(Keys.F4.toString());
    editor.waitTabIsPresent("ModelAndView");
    editor.waitTextElementsActiveLine("ModelAndView");
    editor.waitSpecifiedValueForLineAndChar(44, 14);
    editor.closeFileByNameWithSaving("ModelAndView");

    //Check go to method
    editor.selectTabByName("AppController");
    editor.setCursorToDefinedLineAndChar(43, 16);
    editor.typeTextIntoEditor(Keys.F4.toString());
    editor.waitTabIsPresent("ModelAndView");
    editor.waitTextElementsActiveLine("addObject");
    editor.waitSpecifiedValueForLineAndChar(226, 22);

    //Check go to inner method
    editor.setCursorToDefinedLineAndChar(227, 9);
    editor.typeTextIntoEditor(Keys.F4.toString());
    editor.waitTabIsPresent("ModelAndView");
    editor.waitTextElementsActiveLine("getModelMap()");
    editor.waitSpecifiedValueForLineAndChar(203, 18);
}

From source file:org.eclipse.che.selenium.factory.CreateFactoryFromUiWithKeepDirTest.java

License:Open Source License

private void checkOpenDeclaration() throws IOException {
    String expectedTextBeforeDownloadSources = "package hello;\n" + "\n" + "public class Greeting {\n" + "\n"
            + "    private final long id;\n" + "    private final String content;\n" + "\n"
            + "    public Greeting(long id, String content) {\n" + "        this.id = id;\n"
            + "        this.content = content;\n" + "    }\n" + "\n" + "    public long getId() {\n"
            + "        return id;\n" + "    }\n" + "\n" + "    public String getContent() {\n"
            + "        return content;\n" + "    }\n" + "}";

    editor.setCursorToDefinedLineAndChar(15, 12);
    editor.typeTextIntoEditor(Keys.F4.toString());
    editor.waitTabIsPresent("Greeting");
    editor.waitTextIntoEditor(expectedTextBeforeDownloadSources);
}

From source file:org.eclipse.che.selenium.miscellaneous.WorkingWithTerminalTest.java

License:Open Source License

@Test(priority = 13)
public void shouldEditFileIntoMCEdit() {
    openMC("/projects/" + PROJECT_NAME);

    //check End, Home, F4, Delete keys
    terminal.typeIntoTerminal("" + Keys.END + Keys.ENTER + Keys.END + Keys.ARROW_UP + Keys.F4);
    //select editor
    terminal.typeIntoTerminal(valueOf(1) + Keys.ENTER);

    terminal.waitExpectedTextIntoTerminal(
            "README.md          " + "[----]  0 L:[  1+ 0   1/  1] *(0   /  21b) 0035 0x023");
    terminal.typeIntoTerminal("<!-some comment->");
    terminal.typeIntoTerminal(//www  .  j ava  2 s. c o m
            "" + Keys.HOME + Keys.ARROW_RIGHT + Keys.ARROW_RIGHT + Keys.ARROW_RIGHT + Keys.DELETE);
    terminal.waitExpectedTextIntoTerminal("<!-ome comment->");
}

From source file:org.eclipse.che.selenium.opendeclaration.Eclipse0087Test.java

License:Open Source License

@Test
public void test0087() throws Exception {
    projectExplorer.waitProjectExplorer();
    projectExplorer.waitItem(PROJECT_NAME);
    projectExplorer.quickExpandWithJavaScript();
    projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/test/Test.java");
    editor.waitActiveEditor();//from  w  ww  .j ava 2 s.  c  om
    editor.waitMarkerInPosition(WARNING_MARKER, 12);
    editor.setCursorToDefinedLineAndChar(12, 45);
    editor.typeTextIntoEditor(Keys.F4.toString());
    editor.waitTabIsPresent("Myclass0087");
    editor.waitSpecifiedValueForLineAndChar(13, 14);
}

From source file:org.eclipse.che.selenium.opendeclaration.Eclipse0091Test.java

License:Open Source License

@Test
public void test0091() throws Exception {
    projectExplorer.waitProjectExplorer();
    projectExplorer.waitItem(PROJECT_NAME);
    projectExplorer.quickExpandWithJavaScript();
    projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/test/Test.java");
    editor.waitActiveEditor();/* w w w  . j a  va 2  s .  co m*/
    editor.setCursorToDefinedLineAndChar(13, 5);
    editor.typeTextIntoEditor(Keys.F4.toString());
    editor.waitTabIsPresent("MyAnnot");
    editor.waitSpecifiedValueForLineAndChar(13, 19);
}

From source file:org.eclipse.che.selenium.opendeclaration.Eclipse0093Test.java

License:Open Source License

@Test
public void test0093() throws Exception {
    projectExplorer.waitProjectExplorer();
    projectExplorer.waitItem(PROJECT_NAME);
    projectExplorer.quickExpandWithJavaScript();
    projectExplorer.openItemByPath(PROJECT_NAME + PATH_TO_PACKAGE_PREFIX + "Test.java");
    editor.waitActiveEditor();//from   ww w.  j a  v  a  2  s. c  om
    editor.waitMarkerInPosition(WARNING_MARKER, 12);
    editor.setCursorToDefinedLineAndChar(17, 26);
    editor.typeTextIntoEditor(Keys.F4.toString());
    editor.waitTabIsPresent("MyEnum");
    editor.waitSpecifiedValueForLineAndChar(14, 3);
}