Example usage for org.openqa.selenium Keys ARROW_UP

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

Introduction

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

Prototype

Keys ARROW_UP

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

Click Source Link

Usage

From source file:org.xwiki.test.wysiwyg.framework.AbstractWysiwygTestCase.java

License:Open Source License

public void typeUpArrow() {
    getRichTextArea().sendKeys(Keys.ARROW_UP);
}

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

License:Open Source License

/**
 * @see XWIKI-3090: Cannot move cursor before table
 * @see XWIKI-3089: Cannot move cursor after table
 * @see XWIKI-3829: Use Control/Meta+Up/Down arrow keys to navigate before/after a table
 */// w ww .  java  2  s . c  o m
@Test
public void testMoveCaretBeforeAndAfterTable() {
    switchToSource();
    setSourceText("|=Space|=Page\n|Main|WebHome");
    switchToWysiwyg();

    // Place the caret in one of the table cells.
    moveCaret("document.body.getElementsByTagName('table')[0].rows[0].cells[0].firstChild", 2);

    // Move the caret before the table and type some text. This time using Control+Up.
    getRichTextArea().sendKeys(Keys.chord(Keys.CONTROL, Keys.ARROW_UP), "1");

    // Place the caret again in one of the table cells.
    moveCaret("document.body.getElementsByTagName('table')[0].rows[0].cells[0].firstChild", 2);

    // Move the caret before the table and type some text. This time using Meta+Up.
    // FIXME: Selenium doesn't simulate correctly the Meta key.
    // getRichTextArea().sendKeys(Keys.chord(Keys.META, Keys.ARROW_UP), "2");

    // Place the caret again in one of the table cells.
    moveCaret("document.body.getElementsByTagName('table')[0].rows[1].cells[1].firstChild", 3);

    // Move the caret after the table and type some text. This time using Control+Down.
    getRichTextArea().sendKeys(Keys.chord(Keys.CONTROL, Keys.ARROW_DOWN), "4");

    // Place the caret again in one of the table cells.
    moveCaret("document.body.getElementsByTagName('table')[0].rows[1].cells[1].firstChild", 3);

    // Move the caret after the table and type some text. This time using Meta+Down.
    // FIXME: Selenium doesn't simulate correctly the Meta key.
    // getRichTextArea().sendKeys(Keys.chord(Keys.META, Keys.ARROW_DOWN), "3");

    switchToSource();
    assertSourceText("1\n\n|=Space|=Page\n|Main|WebHome\n\n4");
}