Example usage for org.openqa.selenium Keys ARROW_DOWN

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

Introduction

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

Prototype

Keys ARROW_DOWN

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

Click Source Link

Usage

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

License:Open Source License

/**
 * Filmstrip view send left arrow./*from   ww w .j  a  va 2 s .c  o m*/
 */
public HtmlPage sendKeyDownArrowForFilmstrip() {
    return sendKeysFilmStripViewElement("Send Down Arrow ", Keys.TAB, Keys.ARROW_DOWN);
}

From source file:org.auraframework.components.ui.autocomplete.AutocompleteUITest.java

License:Apache License

/**
 * Using arrow keys to cycle through list items functions properly.
 *//*from  www  .ja v a2 s . c o  m*/
// Excluding mobile devices since they dont have arrow key functionality
@ExcludeBrowsers({ BrowserType.IE7, BrowserType.IE8, BrowserType.ANDROID_PHONE, BrowserType.ANDROID_TABLET,
        BrowserType.IPAD, BrowserType.IPHONE })
public void testAutoCompleteArrowKeys() throws Exception {
    open(URL);
    WebDriver driver = getDriver();
    WebElement input = getAutoCompleteInput(driver, AUTOCOMPLETE_COMPONENT.get("Generic"));

    input.sendKeys("o");
    WebElement list = getAutoCompleteList(driver, AUTOCOMPLETE_COMPONENT.get("Generic"));
    waitForAutoCompleteListVisible(list, true);

    // go to second option in list.
    input.sendKeys(Keys.ARROW_DOWN + "" + Keys.ARROW_DOWN + "");
    auraUITestingUtil.pressEnter(input);
    list = getAutoCompleteList(driver, AUTOCOMPLETE_COMPONENT.get("Generic"));
    waitForAutoCompleteListVisible(list, false);
    assertEquals("Wrong option was selected", "hello world2", input.getAttribute("value"));
}

From source file:org.auraframework.components.ui.autocomplete.AutocompleteUITest.java

License:Apache License

/**
 * Test accessibility when autocompleteOptions is extended 
 *///from  ww  w.j ava  2s.c  o  m
// Excluding mobile devices since they dont have arrow key functionality
@ExcludeBrowsers({ BrowserType.IE7, BrowserType.IE8, BrowserType.ANDROID_PHONE, BrowserType.ANDROID_TABLET,
        BrowserType.IPAD, BrowserType.IPHONE })
public void _testAutoCompleteOptionExtentionAccessibility() throws Exception {
    open(URL);
    WebDriver driver = getDriver();
    WebElement input = getAutoCompleteInput(driver, AUTOCOMPLETE_COMPONENT.get("OptionExtention"));

    // do search
    input.sendKeys("o");
    WebElement list = getAutoCompleteList(driver, AUTOCOMPLETE_COMPONENT.get("OptionExtention"));
    waitForAutoCompleteListVisible(list, true);

    // go to second option in list.
    input.sendKeys(Keys.ARROW_DOWN + "" + Keys.ARROW_DOWN + "");
    list = getAutoCompleteList(driver, AUTOCOMPLETE_COMPONENT.get("OptionExtention"));
    List<WebElement> options = getAutoCompleteListOptions(list, OptionType.AUTOCOMPLETE_CUSTOM_OPTION);
    waitForOptionHighlighted(options.get(1));

    // verify aria attributes
    String ariaActiveDecendant = input.getAttribute("aria-activedescendant");
    String ariaExpanded = input.getAttribute("aria-expanded");
    String optionId = options.get(1).findElement(By.tagName("a")).getAttribute("id");
    assertTrue("aria-expanded should be true", Boolean.parseBoolean(ariaExpanded));
    assertEquals("aria-activedescendant incorrect", optionId, ariaActiveDecendant);

    // escape and verify everything gets reset
    input.sendKeys(Keys.ESCAPE);
    list = getAutoCompleteList(driver, AUTOCOMPLETE_COMPONENT.get("OptionExtention"));
    waitForAutoCompleteListVisible(list, false);

    ariaActiveDecendant = input.getAttribute("aria-activedescendant");
    ariaExpanded = input.getAttribute("aria-expanded");
    assertFalse("aria-expanded should be false after hitting escape", Boolean.parseBoolean(ariaExpanded));
    assertEquals("aria-activedescendant incorrect after hitting escape", "", ariaActiveDecendant);
}

From source file:org.auraframework.components.ui.autocomplete.BaseAutoComplete.java

License:Apache License

/**
 * Using arrow keys to cycle through list items functions properly.
 *//*from  w  ww .  j a v  a  2s  . c om*/
// Excluding mobile devices since they dont have arrow key functionality
@ExcludeBrowsers({ BrowserType.IE7, BrowserType.IE8, BrowserType.ANDROID_PHONE, BrowserType.ANDROID_TABLET,
        BrowserType.IPAD, BrowserType.IPHONE })
public void testAutoCompleteArrowKeys() throws Exception {
    open(URL);
    WebDriver driver = getDriver();
    WebElement input = getAutoCompleteInput(driver, AUTOCOMPLETE_COMPONENT.get("Generic"));

    input.sendKeys("o");
    WebElement list = getAutoCompleteList(driver, AUTOCOMPLETE_COMPONENT.get("Generic"));
    waitForAutoCompleteListVisible(list, true);

    // go to second option in list.
    input.sendKeys(Keys.ARROW_DOWN + "");
    auraUITestingUtil.pressEnter(input);
    list = getAutoCompleteList(driver, AUTOCOMPLETE_COMPONENT.get("Generic"));
    waitForAutoCompleteListVisible(list, false);
    assertEquals("Wrong option was selected", "hello world2", input.getAttribute("value"));
}

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

License:Apache License

/**
 * Keyboard down arrow key does not change page on carousel.
 *//*from www . j  a  v  a  2 s .  c om*/
public void testDownArrow() throws Exception {
    open(URL);
    WebDriver driver = getDriver();
    WebElement carousel = getCarousel(driver, 1);
    doArrowKeysTest(driver, carousel, Keys.ARROW_DOWN, 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 })/* www  .jav a  2  s  .  co m*/
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 down arrow key does not change page on carousel.
 */// ww  w .j  a v  a  2s  .  c  o  m
@Test
public void testDownArrow() throws Exception {
    open(URL);
    WebDriver driver = getDriver();
    WebElement carousel = getCarousel(driver, 1);
    doArrowKeysTest(driver, carousel, Keys.ARROW_DOWN, 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);/* w  w w  . j  a  va2  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 })/*from   w  ww.j a v a2 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.inputDateTime.InputDateTimeUITest.java

License:Apache License

/**
 * Test flow/*from  w ww  . ja va 2s.co m*/
 * - go to 12:00 PM
 * - move to the next time value and see it's 12:30 PM
 * @throws Exception
 */
@Test
public void testTPDownArrow() throws Exception {
    open(URL);

    selectTimePicker(Keys.ARROW_DOWN, TIME_1200_XPATH, "12:30 PM");
}