Example usage for org.openqa.selenium Keys ARROW_LEFT

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

Introduction

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

Prototype

Keys ARROW_LEFT

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

Click Source Link

Usage

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

License:Apache License

/**
 * Using keyboard arrow keys to get to previous page.
 *//*from w  ww.j a  v  a2 s  . com*/
public void testGoToPreviousPage() throws Exception {
    open(URL);
    WebDriver driver = getDriver();
    WebElement carousel = getCarousel(driver, 1);
    doArrowKeysTest(driver, carousel, Keys.ARROW_LEFT, 1, "New Post 1");
}

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

License:Apache License

/**
 * While on first page attempt to move to a non existent page before the first page.
 *//*from ww  w .  ja  v  a 2s  .com*/
public void testMovingBeforeFirstPage() throws Exception {
    open(URL);
    WebDriver driver = getDriver();
    WebElement carousel = getCarousel(driver, 3);
    doArrowKeysTest(driver, carousel, Keys.ARROW_LEFT, 1, "page 1");
}

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  a  v  a2 s .  c om
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.components.ui.inputTextArea.InputTextAreaUITest.java

License:Apache License

public void testTextAreaWithMultipleLinesOfText() throws Exception {
    open(TEST_CMP2);/*from  www .  jav  a  2 s.c  o  m*/
    WebElement div = findDomElement(By.id("textAreaWithLabel"));
    WebElement input = div.findElement(By.tagName("textarea"));
    WebElement outputDiv = findDomElement(By.id("output"));

    String inputAuraId = "textAreaWithLabel";
    String valueExpression = auraUITestingUtil.getValueFromCmpRootExpression(inputAuraId, "v.value");

    String inputText = String.format("%s%n%s%n%s%n%s", "LINE1", "LINE2", "LINE3", "L4");
    input.clear();
    input.click();
    input.sendKeys(inputText);
    input.sendKeys(Keys.ARROW_LEFT, Keys.ARROW_LEFT);
    String inputNewString = "L5";
    input.sendKeys(inputNewString);
    inputText = String.format("%s%n%s%n%s%n%s", "LINE1", "LINE2", "LINE3", "L5L4");
    outputDiv.click(); // to simulate tab behavior for touch browsers
    String actualText = (String) auraUITestingUtil.getEval(valueExpression);
    assertEquals("Total number of bytes with \r\n does not match", inputText.getBytes().length + 3,
            actualText.getBytes().length);
    assertEquals("Value of Input text Area shoud be updated after removing carriage return", inputText,
            actualText.replaceAll("(\\r)", ""));
}

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

License:Apache License

/**
 * Using keyboard arrow keys to get to previous page.
 *///ww  w.j  a va 2s.c o  m
@Test
public void testGoToPreviousPage() throws Exception {
    open(URL);
    WebDriver driver = getDriver();
    WebElement carousel = getCarousel(driver, 1);
    doArrowKeysTest(driver, carousel, Keys.ARROW_LEFT, 1, "New Post 1");
}

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

License:Apache License

/**
 * While on first page attempt to move to a non existent page before the first page.
 *///from   w ww .j  ava  2  s  .  c om
@Test
public void testMovingBeforeFirstPage() throws Exception {
    open(URL);
    WebDriver driver = getDriver();
    WebElement carousel = getCarousel(driver, 3);
    doArrowKeysTest(driver, carousel, Keys.ARROW_LEFT, 1, "page 1");
}

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;//  ww  w.ja va2  s  .c  om

    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 w w .ja v  a 2s. co m*/
    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.inputDate.InputDateWithLabelUITest.java

License:Apache License

@ExcludeBrowsers({ BrowserType.ANDROID_PHONE, BrowserType.ANDROID_TABLET, BrowserType.IPAD,
        BrowserType.IPHONE })/*from  www  .java 2 s  . 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  w  w w  . j  a v  a2 s .  co  m*/
 * - go to 12:30 PM
 * - move to the previous time value and see it's 12:00 PM
 * @throws Exception
 */
@Test
public void testTPUpArrow() throws Exception {
    open(URL);

    selectTimePicker(Keys.ARROW_LEFT, TIME_1230_XPATH, "12:00 PM");
}