Example usage for org.openqa.selenium Keys ARROW_RIGHT

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

Introduction

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

Prototype

Keys ARROW_RIGHT

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

Click Source Link

Usage

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

License:Apache License

@ExcludeBrowsers({ BrowserType.ANDROID_PHONE, BrowserType.ANDROID_TABLET, BrowserType.IPAD,
        BrowserType.IPHONE })//from w w w  .  j  ava 2s .  c o m
public void testLeftAndRightArrows() throws Exception {
    // Increase day in month by 1
    open(URL);
    WebDriver driver = getDriver();

    WebElement element = findDomElement(By.cssSelector(DATE_INPUT_BOX_SEL));
    element.click();
    element.sendKeys(TEST_DATE_TO_USE);
    // Test Begins
    // Grab 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 from todays date, to the todays date +41
    element = loopThroughKeys(element, driver, "" + Keys.ARROW_RIGHT, 41, ARIA_SELECTED_SEL,
            "Arrow-Right key ");

    // Move from today (date+41), to the todays date+1
    element = loopThroughKeys(element, driver, "" + Keys.ARROW_LEFT, 40, ARIA_SELECTED_SEL, "Arrow-Left key");

    // Select element
    element.sendKeys(Keys.SPACE);

    // Focus on the input box and get its value
    element = findDomElement(By.cssSelector(DATE_INPUT_BOX_SEL));
    assertEquals("Next day was not correctly found", "2013-04-16", element.getAttribute("value"));
}

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

License:Apache License

/**
 * Using keyboard arrow keys to get to next page.
 *//*from www .j a  v a  2 s  .co m*/
@PerfTest
@Test
public void testGoToNextPage() throws Exception {
    open(URL);
    WebDriver driver = getDriver();
    WebElement carousel = getCarousel(driver, 1);
    doArrowKeysTest(driver, carousel, Keys.ARROW_RIGHT, 3, "Understanding Execution Governors and Limits");
}

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

License:Apache License

/**
 * While on last page attempt to move to a non existent page after the last page.
 *//*from ww w .  j  a  v  a 2s.  c o  m*/
@Test
public void testMovingPastLastPage() throws Exception {
    open(URL);
    WebDriver driver = getDriver();
    WebElement carousel = getCarousel(driver, 4);
    doArrowKeysTest(driver, carousel, Keys.ARROW_RIGHT, 3, "page 3");
}

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

License:Apache License

private void moveSliderWithKeyboard(WebElement slider, int offset, boolean isPositive) {
    Keys moveKey;//from   w w  w.j  a v  a 2  s  .c  o  m

    if (isPositive) {
        moveKey = Keys.ARROW_RIGHT;
    } else {
        moveKey = Keys.ARROW_LEFT;
    }

    for (int i = 0; i < offset; i++) {
        slider.sendKeys(moveKey);
    }
}

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

License:Apache License

@Test
public void testLeftRightArrow() throws Exception {
    open(inlineURL);//from   w ww  .  ja  va2  s. com
    WebDriver driver = getDriver();
    switchKeyboardMode(driver);
    pressKey(driver, Keys.ARROW_RIGHT);
    WebElement activeCell = waitForActiveCellToLoad(driver);
    assertEquals("Name0", activeCell.findElement(By.className("uiOutputText")).getText());
    for (int i = 0; i < 7; ++i) {
        pressKey(driver, Keys.ARROW_RIGHT);
    }
    for (int i = 0; i < 7; ++i) {
        pressKey(driver, Keys.ARROW_LEFT);
    }
    activeCell = waitForActiveCellToLoad(driver);
    assertEquals("Name0", activeCell.findElement(By.className("uiOutputText")).getText());
}

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

License:Apache License

@Test
public void testEnterEditCell() throws Exception {
    open(inlineURL);/*from   w  ww .  j  a va2 s. c  o m*/
    WebDriver driver = getDriver();
    switchKeyboardMode(driver);
    pressKey(driver, Keys.ARROW_RIGHT);
    pressKey(driver, EDIT_TRIGGER_SELECTOR, Keys.ENTER);
    assertNotNull(driver.findElement(By.cssSelector(INPUT_PANEL_SELECTOR)));
}

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  w  w  . j  a va  2  s . co  m
// TODO(W-2701964): Flapping in autobuilds, needs to be revisited
@Flapper
@Test
public void testDateWithOneArrow() throws Exception {
    open(URL);

    WebElement element = findDomElement(By.cssSelector(DATE_INPUT_BOX_SEL));
    element.sendKeys("2013-10-01");
    element.click();

    openDatePicker();

    String classOfActiveElem = "" + getAuraUITestingUtil().getEval(CLASSNAME);

    element = findDomElement(By.cssSelector("td[class*='" + classOfActiveElem + "']"));

    // Loop through 151 days
    element = loopThroughKeys(element, "" + Keys.ARROW_RIGHT, 151, ARIA_SELECTED_SEL, "Arrow-Right ");

    element.sendKeys(Keys.SPACE);

    element = findDomElement(By.cssSelector(DATE_INPUT_BOX_SEL));
    assertEquals("Dates do not match up", "2014-03-01", element.getAttribute("value").trim());
}

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  w  w  .j  a v  a 2s  . c  om
@Test
public void testLeftAndRightArrows() throws Exception {
    open(URL);

    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
    By activeElmLoc = By.cssSelector("td[class*='" + getAuraUITestingUtil().getEval(CLASSNAME) + "']");
    element = findDomElement(activeElmLoc);

    // Move from todays date, to the todays date +41
    element = loopThroughKeys(element, "" + Keys.ARROW_RIGHT, 41, ARIA_SELECTED_SEL, "Arrow-Right key ");

    // Move from today (date+41), to the todays date+1
    element = loopThroughKeys(element, "" + Keys.ARROW_LEFT, 40, ARIA_SELECTED_SEL, "Arrow-Left key");

    // Select element
    element.sendKeys(Keys.SPACE);

    // Focus on the input box and get its value
    element = findDomElement(By.cssSelector(DATE_INPUT_BOX_SEL));
    assertEquals("Next day was not correctly found", "2013-04-16", element.getAttribute("value").trim());
}

From source file:org.auraframework.integration.test.components.ui.inputDateTime.InputDateTimeUITest.java

License:Apache License

/**
 * Test flow//from www.j a  v  a  2  s .c  o  m
 * - go to 12:00 PM
 * - move to the next time value and see it's 12:30 PM
 * @throws Exception
 */
@Test
public void testTPRightArrow() throws Exception {
    open(URL);

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

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

License:Apache License

/**
 * Function to navigate from a random tab to the overflow menu and open overflow menu
 * /*w  ww . j a v  a 2s  . com*/
 * @param startIndex - Index or the tab from which to start navigating to overflow menu
 * @param useTab - Use tab key to navigate to overflow menu
 * @param openMethod - Keyboard key with which to open overflow menu
 */
public void overflowKeyboardNav(int startIndex, Boolean useTabKey, Keys openMethod) {

    WebElement tab = findDomElement(By.linkText(OVERFLOW_TITLE_ARRAY[startIndex]));
    tab.click();
    waitForTabSelected("Did not switch over to " + OVERFLOW_TITLE_ARRAY[startIndex] + " tab", tab);

    if (useTabKey) {
        getAuraUITestingUtil().pressTab(tab);
    } else {
        // Navigate only up to the overflow menu
        for (int i = startIndex; i < NUMBER_OF_TABS_OVERFLOW_TABSET; i++) {
            tab.sendKeys(Keys.ARROW_RIGHT);
            int nextIndex = i + 1;
            nextIndex = nextIndex == NUMBER_OF_TABS_OVERFLOW_TABSET ? nextIndex - 1 : nextIndex;
            waitForTabSelected("Did not switch over to " + OVERFLOW_TITLE_ARRAY[nextIndex] + " tab",
                    findDomElement(By.linkText(OVERFLOW_TITLE_ARRAY[nextIndex])));
            tab = findDomElement(ACTIVE_LI_LOCATOR);
        }
    }

    WebElement activeElement = (WebElement) getAuraUITestingUtil().getEval("return $A.test.getActiveElement()");
    WebElement overflowElement = findDomElement(OVERFLOW_LOCATOR);
    assertTrue(activeElement.equals(overflowElement));

    openOverflowMenu(overflowElement, openMethod);

    waitForOverflowMenuOpen();
}