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:com.vaadin.tests.components.grid.basicfeatures.server.GridSortingTest.java

License:Apache License

@Test
public void testKeyboardSorting() {
    openTestURL();/*from ww  w  . jav  a  2s  .  co m*/

    /*
     * We can't click on the header directly, since it will sort the header
     * immediately. We need to focus some other column first, and only then
     * navigate there.
     */
    getGridElement().getCell(0, 0).click();
    sendKey(Keys.ARROW_UP);

    // Sort ASCENDING on first column
    sendKey(Keys.ENTER);
    assertLastSortIsUserOriginated(true);
    assertColumnsAreSortedAs(_(1, SortDirection.ASCENDING));

    // Move to next column
    sendKey(Keys.RIGHT);

    // Add this column to the existing sorting group
    holdKey(Keys.SHIFT);
    sendKey(Keys.ENTER);
    releaseKey(Keys.SHIFT);
    assertColumnsAreSortedAs(_(1, SortDirection.ASCENDING), _(2, SortDirection.ASCENDING));

    // Move to next column
    sendKey(Keys.RIGHT);

    // Add a third column to the sorting group
    holdKey(Keys.SHIFT);
    sendKey(Keys.ENTER);
    releaseKey(Keys.SHIFT);
    assertColumnsAreSortedAs(_(1, SortDirection.ASCENDING), _(2, SortDirection.ASCENDING),
            _(3, SortDirection.ASCENDING));

    // Move back to the second column
    sendKey(Keys.LEFT);

    // Change sort direction of the second column to DESCENDING
    holdKey(Keys.SHIFT);
    sendKey(Keys.ENTER);
    releaseKey(Keys.SHIFT);
    assertColumnsAreSortedAs(_(1, SortDirection.ASCENDING), _(2, SortDirection.DESCENDING),
            _(3, SortDirection.ASCENDING));

    // Move back to the third column
    sendKey(Keys.RIGHT);

    // Set sorting to third column, ASCENDING
    sendKey(Keys.ENTER);
    assertColumnsAreSortedAs(_(2, 1, SortDirection.ASCENDING));

    // Move to the fourth column
    sendKey(Keys.RIGHT);

    // Make sure that single-column sorting also works as expected
    sendKey(Keys.ENTER);
    assertColumnsAreSortedAs(_(3, 1, SortDirection.ASCENDING));

}

From source file:com.vaadin.tests.components.tree.TreeKeyboardNavigationToNoneTest.java

License:Apache License

@Test
public void navigateUpForTheFirstItem() {
    sendKey(Keys.ARROW_UP);
    checkNotificationErrorAbsence("first");
}

From source file:org.alfresco.po.share.site.document.FilmstripActions.java

License:Open Source License

/**
 * Filmstrip view send right arrow.//from   www . j av a2 s.co m
 */
public HtmlPage sendKeyUpArrowForFilmstrip() {
    return sendKeysFilmStripViewElement("Send Up Arrow ", Keys.TAB, Keys.ARROW_UP);
}

From source file:org.auraframework.components.ui.carousel.CarouselUITest.java

License:Apache License

/**
 * Keyboard up arrow key does not change page on carousel.
 *//*from  w  w  w .jav  a  2  s .c  o  m*/
public void testUpArrow() throws Exception {
    open(URL);
    WebDriver driver = getDriver();
    WebElement carousel = getCarousel(driver, 1);
    doArrowKeysTest(driver, carousel, Keys.ARROW_UP, 2, "New Post 2");
}

From source file:org.auraframework.components.ui.inputDate.BaseInputDateUITester.java

License:Apache License

@ExcludeBrowsers({ BrowserType.ANDROID_PHONE, BrowserType.ANDROID_TABLET, BrowserType.IPAD,
        BrowserType.IPHONE })/*  w  ww.  j a v a2  s  .  c  om*/
public void testUpAndDownArrows() throws Exception {

    open(URL);
    WebDriver driver = getDriver();

    // Start at specific date
    WebElement element = findDomElement(By.cssSelector(DATE_INPUT_BOX_SEL));
    element.click();
    element.sendKeys(TEST_DATE_TO_USE);

    // Test Begins
    // Select the calendar Icon
    element = findDomElement(By.cssSelector(DATE_ICON_SEL));
    element.click();

    // Find todays date, which should be focused
    String classOfActiveElem = "" + auraUITestingUtil.getEval(CLASSNAME);
    element = findDomElement(By.cssSelector("a[class*='" + classOfActiveElem + "']"));

    // Move 4 months up
    element = loopThroughKeys(element, driver, "" + Keys.ARROW_UP, 4, ARIA_SELECTED_SEL, "Arrow-Up key");

    // Move 4 months down
    element = loopThroughKeys(element, driver, "" + Keys.ARROW_DOWN, 4, ARIA_SELECTED_SEL, "Arrow-Down key");

    // Focus should be back on todays date
    element.sendKeys(Keys.SPACE);

    // Select the input text box and get its value for comparison
    element = findDomElement(By.cssSelector(DATE_INPUT_BOX_SEL));
    assertEquals("Moving dates using arrows has not brought us to todays date", TEST_DATE_TO_USE,
            element.getAttribute("value"));
}

From source file:org.auraframework.integration.test.components.ui.carousel.CarouselUITest.java

License:Apache License

/**
 * Keyboard up arrow key does not change page on carousel.
 *//*from w  ww .ja  va2 s .  co  m*/
@Test
public void testUpArrow() throws Exception {
    open(URL);
    WebDriver driver = getDriver();
    WebElement carousel = getCarousel(driver, 1);
    doArrowKeysTest(driver, carousel, Keys.ARROW_UP, 2, "New Post 2");
}

From source file:org.auraframework.integration.test.components.ui.inlineEditGrid.InlineEditGridUITest.java

License:Apache License

@Test
public void testUpDownArrow() throws Exception {
    open(inlineURL);/*from  w ww .j  ava 2 s  . co m*/
    WebDriver driver = getDriver();
    switchKeyboardMode(driver);
    pressKey(driver, Keys.TAB);
    for (int i = 0; i < 7; ++i) {
        WebElement activeCell = waitForActiveCellToLoad(driver);
        // verify active cell is in correct place
        assertEquals("Name" + i, activeCell.findElement(By.className("uiOutputText")).getText());
        pressKey(driver, Keys.ARROW_DOWN);
    }
    for (int i = 0; i < 7; ++i) {
        pressKey(driver, Keys.ARROW_UP);
    }
    WebElement activeCell = waitForActiveCellToLoad(driver);
    assertEquals("Name0", activeCell.findElement(By.className("uiOutputText")).getText());
}

From source file:org.auraframework.integration.test.components.ui.inputDate.InputDateWithLabelUITest.java

License:Apache License

@ExcludeBrowsers({ BrowserType.ANDROID_PHONE, BrowserType.ANDROID_TABLET, BrowserType.IPAD,
        BrowserType.IPHONE })//w  ww . j av  a 2 s. c  o m
@Test
public void testUpAndDownArrows() throws Exception {
    open(URL);

    // Start at specific date
    WebElement element = findDomElement(By.cssSelector(DATE_INPUT_BOX_SEL));
    element.sendKeys(TEST_DATE_TO_USE);
    element.click();

    openDatePicker();

    // Find todays date, which should be focused
    String classOfActiveElem = "" + getAuraUITestingUtil().getEval(CLASSNAME);
    element = findDomElement(By.cssSelector("td[class*='" + classOfActiveElem + "']"));

    // Move 4 months up
    element = loopThroughKeys(element, "" + Keys.ARROW_UP, 4, ARIA_SELECTED_SEL, "Arrow-Up key");

    // Move 4 months down
    element = loopThroughKeys(element, "" + Keys.ARROW_DOWN, 4, ARIA_SELECTED_SEL, "Arrow-Down key");

    // Focus should be back on todays date
    element.sendKeys(Keys.SPACE);

    // Select the input text box and get its value for comparison
    element = findDomElement(By.cssSelector(DATE_INPUT_BOX_SEL));
    assertEquals("Moving dates using arrows has not brought us to todays date", TEST_DATE_TO_USE,
            element.getAttribute("value").trim());
}

From source file:org.auraframework.integration.test.components.ui.tabset.TabsetUITest.java

License:Apache License

/**
 * Test that will verify that the arrows keys work. This is not something that will be run on mobile devices
 * //from w ww  .  ja va 2 s .  c o m
 * IE7/8 don't handle arrows well.
 */
@ExcludeBrowsers({ BrowserType.ANDROID_PHONE, BrowserType.ANDROID_TABLET, BrowserType.IPHONE, BrowserType.IPAD,
        BrowserType.IE8, BrowserType.IE7 })
@Test
public void testLeftRightUpDownArrows() throws Exception {
    open(createURL("basic", "false"));

    // Left/Up and Right/Down Arrows do the samething. Making sure that the result is also the same
    iterateThroughTabs(Keys.ARROW_RIGHT, Keys.ARROW_LEFT);
    iterateThroughTabs(Keys.ARROW_DOWN, Keys.ARROW_UP);
}

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();//from w  w  w. j a v a  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);
}