Example usage for org.openqa.selenium Keys F5

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

Introduction

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

Prototype

Keys F5

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

Click Source Link

Usage

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 w w  . j av  a2 s  .  c  o  m
}

From source file:org.auraframework.integration.test.http.AuraResourceServletUITest.java

License:Apache License

private void openCachesAppWithRefresh(String cache, String key) throws Exception {
    open(CACHES_URL + "?key=" + BOGUS_KEY);
    waitForKey(BOGUS_KEY);/*ww  w. ja  v  a 2 s  .  c om*/
    WebElement el = getDriver().findElement(By.className("searchButton"));
    el.sendKeys(Keys.CONTROL, Keys.F5);
    open(CACHES_URL + "?cache=" + cache + "&key=" + key);
    waitForCache(cache);
    waitForKey(key);
}

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

License:Open Source License

@Test(priority = 1)
public void shouldAppearMCDialogs() {
    terminal.typeIntoTerminal("cd ~ && touch -f testfile.txt" + Keys.ENTER);

    openMC("~");/*from www. j a v  a2  s. c  o  m*/
    //check F5
    terminal.typeIntoTerminal("" + Keys.END + Keys.F5);

    terminal.waitExpectedTextIntoTerminal("Copy file \"testfile.txt\" with source mask");
    terminal.typeIntoTerminal("" + Keys.ESCAPE + Keys.ESCAPE);

    //check F6
    terminal.typeIntoTerminal(Keys.F6.toString());
    terminal.waitExpectedTextIntoTerminal("Move file \"testfile.txt\" with source mask");
    terminal.typeIntoTerminal("" + Keys.ESCAPE + Keys.ESCAPE);

    //check F7
    terminal.typeIntoTerminal(Keys.F7.toString());
    terminal.waitExpectedTextIntoTerminal("Enter directory name:");
    terminal.typeIntoTerminal("" + Keys.ESCAPE + Keys.ESCAPE);

    //check F8
    terminal.typeIntoTerminal(Keys.F8.toString());
    terminal.waitExpectedTextIntoTerminal("Delete file");
    terminal.waitExpectedTextIntoTerminal("\"testfile.txt\"?");
    terminal.typeIntoTerminal("" + Keys.ESCAPE + Keys.ESCAPE);

    //check F9 - Select menu in MC
    terminal.typeIntoTerminal("" + Keys.F9 + Keys.ENTER);
    terminal.waitExpectedTextIntoTerminal("File listing");
    terminal.typeIntoTerminal("" + Keys.ESCAPE + Keys.ESCAPE);
}

From source file:org.eclipse.scout.rt.testing.ui.rap.RapMock.java

License:Open Source License

protected Keys toSeleniumKey(Key key) {
    switch (key) {
    case Shift://www.j a va2  s.  c om
        return Keys.SHIFT;
    case Control:
        return Keys.CONTROL;
    case Alt:
        return Keys.ALT;
    case Delete:
        return Keys.DELETE;
    case Backspace:
        return Keys.BACK_SPACE;
    case Enter:
        return Keys.ENTER;
    case Esc:
        return Keys.ESCAPE;
    case Tab:
        return Keys.TAB;
    case ContextMenu:
        throw new IllegalArgumentException("Unknown keyboard key: " + key);
    case Up:
        return Keys.UP;
    case Down:
        return Keys.DOWN;
    case Left:
        return Keys.LEFT;
    case Right:
        return Keys.RIGHT;
    case Windows:
        return Keys.META;
    case F1:
        return Keys.F1;
    case F2:
        return Keys.F2;
    case F3:
        return Keys.F3;
    case F4:
        return Keys.F4;
    case F5:
        return Keys.F5;
    case F6:
        return Keys.F6;
    case F7:
        return Keys.F7;
    case F8:
        return Keys.F8;
    case F9:
        return Keys.F9;
    case F10:
        return Keys.F10;
    case F11:
        return Keys.F11;
    case F12:
        return Keys.F12;
    case Home:
        return Keys.HOME;
    case End:
        return Keys.END;
    case PageUp:
        return Keys.PAGE_UP;
    case PageDown:
        return Keys.PAGE_DOWN;
    case NumPad0:
        return Keys.NUMPAD0;
    case NumPad1:
        return Keys.NUMPAD1;
    case NumPad2:
        return Keys.NUMPAD2;
    case NumPad3:
        return Keys.NUMPAD3;
    case NumPad4:
        return Keys.NUMPAD4;
    case NumPad5:
        return Keys.NUMPAD5;
    case NumPad6:
        return Keys.NUMPAD6;
    case NumPad7:
        return Keys.NUMPAD7;
    case NumPad8:
        return Keys.NUMPAD8;
    case NumPadMultiply:
        return Keys.MULTIPLY;
    case NumPadDivide:
        return Keys.DIVIDE;
    case NumPadAdd:
        return Keys.ADD;
    case NumPadSubtract:
        return Keys.SUBTRACT;
    case NumPadDecimal:
        return Keys.DECIMAL;
    case NumPadSeparator:
        return Keys.SEPARATOR;
    default:
        throw new IllegalArgumentException("Unknown keyboard key: " + key);
    }
}

From source file:org.glowroot.agent.webdriver.tests.BasicSmokeIT.java

License:Apache License

@Test
public void shouldCheckTransactionPages() throws Exception {
    // given/*ww  w  .java  2s.  c om*/
    App app = new App(driver, "http://localhost:" + getUiPort());
    GlobalNavbar globalNavbar = new GlobalNavbar(driver);

    app.open();

    // hitting F5 is just to test 304 responses
    Utils.withWait(driver, By.partialLinkText("Response time")).sendKeys(Keys.F5);

    Utils.withWait(driver, By.xpath("//a[@gt-display='All Servlet Transactions'][contains(., '%')]"));
    driver.findElement(By.xpath("//button[@title='By percent of total time']")).click();
    driver.findElement(By.linkText("By average time")).click();
    Utils.withWait(driver, By.xpath("//a[@gt-display='All Servlet Transactions'][contains(., 'ms')]"));
    driver.findElement(By.xpath("//button[@title='By average time']")).click();
    driver.findElement(By.linkText("By throughput (per min)")).click();
    Utils.withWait(driver, By.xpath("//a[@gt-display='All Servlet Transactions'][contains(., '/min')]"));
    driver.findElement(By.xpath("//button[@title='By throughput (per min)']")).click();
    driver.findElement(By.linkText("By percent of total time")).click();
    Utils.withWait(driver, By.xpath("//a[@gt-display='All Servlet Transactions'][contains(., '%')]"));

    Utils.withWait(driver, By.partialLinkText("percentiles")).click();
    Utils.withWait(driver, By.partialLinkText("throughput")).click();
    Utils.withWait(driver, By.partialLinkText("Slow traces")).click();
    Utils.withWait(driver, By.partialLinkText("External queries")).click();
    Utils.withWait(driver, By.partialLinkText("Continuous profiling")).click();
    Utils.withWait(driver, By.xpath("//input[@ng-model='filter']")).sendKeys("JdbcServlet");
    Utils.withWait(driver, By.xpath("//button[@ng-click='refreshButtonClick()']")).click();
    new WebDriverWait(driver, 30).until(
            ExpectedConditions.textToBePresentInElementLocated(By.className("gt-profile"), "JdbcServlet"));

    Utils.withWait(driver, By.linkText("View flame graph (experimental)")).click();
    // give flame graph a chance to render (only for visual when running locally)
    Thread.sleep(500);
    globalNavbar.getTransactionsLink().click();
    Utils.withWait(driver, By.partialLinkText("/jdbcservlet")).click();
    Utils.withWait(driver, By.partialLinkText("percentiles")).click();
    Utils.withWait(driver, By.partialLinkText("Slow traces")).click();
    Utils.withWait(driver, By.partialLinkText("External queries")).click();
    Utils.withWait(driver, By.partialLinkText("Continuous profiling")).click();
    Utils.withWait(driver, By.linkText("View flame graph (experimental)")).click();
}

From source file:org.glowroot.tests.BasicSmokeIT.java

License:Apache License

@Test
public void shouldCheckTransactionPages() throws Exception {
    App app = app();//from ww  w.  j  a v  a 2s .com
    GlobalNavbar globalNavbar = globalNavbar();

    app.open();

    // hitting F5 is just to test 304 responses
    Utils.withWait(driver, By.partialLinkText("Response time")).sendKeys(Keys.F5);

    Utils.withWait(driver, By.xpath("//a[@gt-display='All Web Transactions'][contains(., '%')]"));
    driver.findElement(By.xpath("//button[@title='By percent of total time']")).click();
    driver.findElement(By.linkText("By average time")).click();
    Utils.withWait(driver, By.xpath("//a[@gt-display='All Web Transactions'][contains(., 'ms')]"));
    driver.findElement(By.xpath("//button[@title='By average time']")).click();
    driver.findElement(By.linkText("By throughput (per min)")).click();
    Utils.withWait(driver, By.xpath("//a[@gt-display='All Web Transactions'][contains(., '/min')]"));
    driver.findElement(By.xpath("//button[@title='By throughput (per min)']")).click();
    driver.findElement(By.linkText("By percent of total time")).click();
    Utils.withWait(driver, By.xpath("//a[@gt-display='All Web Transactions'][contains(., '%')]"));

    Utils.withWait(driver, By.partialLinkText("percentiles")).click();
    Utils.withWait(driver, By.partialLinkText("throughput")).click();
    Utils.withWait(driver, By.partialLinkText("Slow traces")).click();
    Utils.withWait(driver, By.partialLinkText("Queries")).click();
    Utils.withWait(driver, By.partialLinkText("Continuous profiling")).click();
    Utils.withWait(driver, By.xpath("//input[@ng-model='filter']")).sendKeys("JdbcServlet");
    Utils.withWait(driver, By.xpath("//button[@ng-click='refresh()']")).click();
    new WebDriverWait(driver, 30).until(
            ExpectedConditions.textToBePresentInElementLocated(By.className("gt-profile"), "JdbcServlet"));

    Utils.withWait(driver, By.linkText("View flame graph (experimental)")).click();
    // give flame graph a chance to render (only for visual when running locally)
    Thread.sleep(1000);
    globalNavbar.getTransactionsLink().click();
    Utils.withWait(driver, By.partialLinkText("/jdbcservlet")).click();
    Utils.withWait(driver, By.partialLinkText("percentiles")).click();
    Utils.withWait(driver, By.partialLinkText("Slow traces")).click();
    Utils.withWait(driver, By.partialLinkText("Queries")).click();
    Utils.withWait(driver, By.partialLinkText("Continuous profiling")).click();
    Utils.withWait(driver, By.linkText("View flame graph (experimental)")).click();
}

From source file:org.glowroot.tests.webdriver.BasicSmokeTest.java

License:Apache License

@Test
public void shouldCheckTransactionPages() throws Exception {
    // given/*from  ww w. j a  v a2 s. c  o m*/
    App app = new App(driver, "http://localhost:" + container.getUiPort());
    GlobalNavbar globalNavbar = new GlobalNavbar(driver);

    app.open();

    // hitting F5 is just to test 304 responses
    Utils.withWait(driver, By.partialLinkText("Metrics")).sendKeys(Keys.F5);

    Utils.withWait(driver, By.xpath("//a[@gt-display='All Transactions'][contains(., '%')]"));
    driver.findElement(By.xpath("//button[@title='By percent of total time']")).click();
    driver.findElement(By.linkText("By average time")).click();
    Utils.withWait(driver, By.xpath("//a[@gt-display='All Transactions'][contains(., 'ms')]"));
    driver.findElement(By.xpath("//button[@title='By average time']")).click();
    driver.findElement(By.linkText("By throughput (per min)")).click();
    Utils.withWait(driver, By.xpath("//a[@gt-display='All Transactions'][contains(., '/min')]"));
    driver.findElement(By.xpath("//button[@title='By throughput (per min)']")).click();
    driver.findElement(By.linkText("By percent of total time")).click();
    Utils.withWait(driver, By.xpath("//a[@gt-display='All Transactions'][contains(., '%')]"));

    Utils.withWait(driver, By.partialLinkText("Metrics")).click();
    Utils.withWait(driver, By.partialLinkText("Traces")).click();
    Utils.withWait(driver, By.partialLinkText("Profile")).click();
    Utils.withWait(driver, By.linkText("View flame graph (experimental)")).click();
    // give flame graph a chance to render (only for visual when running locally)
    Thread.sleep(500);
    globalNavbar.getTransactionsLink().click();
    Utils.withWait(driver, By.partialLinkText("/jdbcservlet")).click();
    Utils.withWait(driver, By.partialLinkText("Metrics")).click();
    Utils.withWait(driver, By.partialLinkText("Traces")).click();
    Utils.withWait(driver, By.partialLinkText("Profile")).click();
    Utils.withWait(driver, By.linkText("View flame graph (experimental)")).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/*w  w  w . j a va 2  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.wysiwyg.test.ui.EditWYSIWYGTest.java

License:Open Source License

/**
 * Test that the content of the rich text area is preserved when the user refreshes the page.
 *//*from  w w w  .  j  av  a2 s  .c om*/
@Test
@IgnoreBrowsers({
        @IgnoreBrowser(value = "internet.*", version = "8\\.*", reason = "See http://jira.xwiki.org/browse/XE-1146"),
        @IgnoreBrowser(value = "internet.*", version = "9\\.*", reason = "See http://jira.xwiki.org/browse/XE-1177") })
public void testPreserveUnsavedRichContentAgainstRefresh() {
    // Type text and refresh the page.
    this.editPage.getContentEditor().getRichTextArea().sendKeys("2");
    this.editPage.sendKeys(Keys.F5);

    this.editPage = new WYSIWYGEditPage();
    EditorElement editor = this.editPage.getContentEditor();
    editor.waitToLoad();

    // Type more text and check the result.
    RichTextAreaElement textArea = editor.getRichTextArea();
    textArea.sendKeys("1");
    Assert.assertEquals("12", textArea.getText());
}

From source file:org.xwiki.wysiwyg.test.ui.EditWYSIWYGTest.java

License:Open Source License

/**
 * Test that the content of the source text area is preserved when the user refreshes the page.
 *///from w  ww .j  a  va2s  .  c o  m
@Test
@IgnoreBrowsers({
        @IgnoreBrowser(value = "internet.*", version = "8\\.*", reason = "See http://jira.xwiki.org/browse/XE-1146"),
        @IgnoreBrowser(value = "internet.*", version = "9\\.*", reason = "See http://jira.xwiki.org/browse/XE-1177") })
public void testPreserveUnsavedSourceAgainstRefresh() {
    EditorElement editor = this.editPage.getContentEditor();
    editor.switchToSource();

    // Type text and refresh the page.
    editor.getSourceTextArea().sendKeys("1" + Keys.F5);

    this.editPage = new WYSIWYGEditPage();
    editor = this.editPage.getContentEditor();
    editor.waitToLoad();
    editor.switchToSource();

    // Type more text and check the result.
    editor.getSourceTextArea().sendKeys("2");
    Assert.assertEquals("12", editor.getSourceTextArea().getAttribute("value"));
}