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

License:Apache License

@Test
public void testNavigationWithHiddenColumns_hiddenFirstAndLastColumn_keepsNavigation() {
    selectMenuPath("Component", "State", "Width", "1000px");
    toggleHideColumnAPI(0);//  ww  w.  j  a  va  2  s  .  c o m
    assertColumnHeaderOrder(1, 2, 3, 4, 5, 6);

    getGridElement().getCell(2, 1).click();
    assertTrue(getGridElement().getCell(2, 1).isFocused());

    new Actions(getDriver()).sendKeys(Keys.ARROW_LEFT);
    GridCellElement cell = getGridElement().getCell(2, 1);
    assertTrue(cell.isFocused());

    scrollGridHorizontallyTo(10000);

    //
    getGridElement().getHeaderCell(0, 9).click();
    cell = getGridElement().getHeaderCell(0, 9);
    assertTrue(cell.isFocused());
    toggleHideColumnAPI(10);
    toggleHideColumnAPI(11);

    new Actions(getDriver()).sendKeys(Keys.ARROW_RIGHT);
    new Actions(getDriver()).sendKeys(Keys.ARROW_RIGHT);
    toggleHideColumnAPI(10);
    toggleHideColumnAPI(11);
    cell = getGridElement().getHeaderCell(0, 9);
    assertTrue(cell.isFocused());
}

From source file:com.vaadin.tests.components.grid.basicfeatures.server.GridKeyboardNavigationTest.java

License:Apache License

@Test
public void testSimpleKeyboardNavigation() {
    openTestURL();//www  .j  a  va  2s  .c  o  m

    GridElement grid = getGridElement();
    grid.getCell(0, 0).click();

    new Actions(getDriver()).sendKeys(Keys.ARROW_DOWN).perform();
    assertTrue("Body cell 1, 0 is not focused after keyboard navigation.", grid.getCell(1, 0).isFocused());

    new Actions(getDriver()).sendKeys(Keys.ARROW_RIGHT).perform();
    assertTrue("Body cell 1, 1 is not focused after keyboard navigation.", grid.getCell(1, 1).isFocused());

    int i;
    for (i = 1; i < 40; ++i) {
        new Actions(getDriver()).sendKeys(Keys.ARROW_DOWN).perform();
    }

    assertFalse("Grid has not scrolled with cell focus", isElementPresent(By.xpath("//td[text() = '(0, 0)']")));
    assertTrue("Cell focus is not visible", isElementPresent(By.xpath("//td[text() = '(" + i + ", 0)']")));
    assertTrue("Body cell " + i + ", 1 is not focused", grid.getCell(i, 1).isFocused());
}

From source file:com.vaadin.tests.components.grid.basicfeatures.server.GridSortingTest.java

License:Apache License

@Test
public void testKeyboardSortingMultipleHeaders() {
    openTestURL();// w  w  w .  j a v a  2  s . co m
    selectMenuPath("Component", "Header", "Append row");

    // Sort according to first column by clicking
    getGridElement().getHeaderCell(0, 0).click();
    assertColumnIsSorted(0);

    // Try to sort according to second column by pressing enter on the new
    // header
    sendKey(Keys.ARROW_RIGHT);
    sendKey(Keys.ARROW_DOWN);
    sendKey(Keys.ENTER);

    // Should not have sorted
    assertColumnIsSorted(0);

    // Sort using default header
    sendKey(Keys.ARROW_UP);
    sendKey(Keys.ENTER);

    // Should have sorted
    assertColumnIsSorted(1);

}

From source file:GlennsPack.GlennWebAPI.Bot2048.java

License:Open Source License

public Bot2048() {
    System.setProperty("webdriver.chrome.driver", "C:/Users/Glenn/Downloads/chromedriver/chromedriver.exe");
    WebDriver driver = new ChromeDriver();

    driver.manage().window().setSize(new Dimension(2000, 800));

    driver.get("http://annimon.github.io/16384/");

    //      try {
    //         Thread.sleep(2000);
    //      } catch (Exception e) {
    //         // FIXME: handle exception
    //      }// w w w . ja  v a2s.  c om
    //      
    WebElement element = driver.findElement(By.xpath("/html/body/div"));
    //            ("/html/body/div/div[2]"));

    Actions actions = new Actions(driver);
    actions.moveToElement(element);
    actions.click();
    CharSequence[] array = { Keys.ARROW_DOWN, Keys.ARROW_LEFT, Keys.ARROW_RIGHT };
    for (int i = 0; i < 1000000; i++) {
        Random random = new Random();
        actions.sendKeys(array[random.nextInt(3)]);
        ;
        actions.sendKeys(Keys.ARROW_DOWN);
        actions.build().perform();
        try {
            //         Thread.sleep(1);
        } catch (Exception e) {
            // FIXME: handle exception
        }
    }
}

From source file:org.alfresco.po.share.DashBoardPageTest.java

License:Open Source License

@Test(dependsOnMethods = "refreshPage", enabled = false, groups = "nonGrid")
public void testKeysForHeaderBar() throws Exception {
    driver.navigate().refresh();/*  w w  w.j  a va2s .c  om*/
    dashBoard.inputFromKeyborad(Keys.TAB);
    dashBoard.inputFromKeyborad(Keys.ARROW_RIGHT);
    dashBoard.inputFromKeyborad(Keys.ARROW_RIGHT);
    dashBoard.inputFromKeyborad(Keys.RETURN);
    Assert.assertTrue(resolvePage(driver).render() instanceof SharedFilesPage);
}

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

License:Open Source License

/**
 * Filmstrip view send right arrow./*from  ww w.  j a v  a2 s  . co  m*/
 */
public HtmlPage sendKeyRightArrowForFilmstrip() {
    return sendKeysFilmStripViewElement("Send right key ", Keys.TAB, Keys.ARROW_RIGHT);
}

From source file:org.apache.zeppelin.integration.ParagraphActionsIT.java

License:Apache License

public void testEditOnDoubleClick() throws Exception {
    try {/*from  w w  w .j  a  v a2  s  .  c  om*/
        createNewNote();
        Actions action = new Actions(driver);

        waitForParagraph(1, "READY");

        setTextOfParagraph(1, "%md");
        driver.findElement(By.xpath(getParagraphXPath(1) + "//textarea")).sendKeys(Keys.ARROW_RIGHT);
        driver.findElement(By.xpath(getParagraphXPath(1) + "//textarea")).sendKeys(Keys.ENTER);
        driver.findElement(By.xpath(getParagraphXPath(1) + "//textarea")).sendKeys(Keys.SHIFT + "3");
        driver.findElement(By.xpath(getParagraphXPath(1) + "//textarea")).sendKeys(" abc");

        runParagraph(1);
        waitForParagraph(1, "FINISHED");

        collector.checkThat("Markdown editor is hidden after run ",
                driver.findElements(By
                        .xpath(getParagraphXPath(1) + "//div[contains(@ng-if, 'paragraph.config.editorHide')]"))
                        .size(),
                CoreMatchers.equalTo(0));

        collector.checkThat("Markdown editor is shown after run ",
                driver.findElement(By.xpath(
                        getParagraphXPath(1) + "//div[contains(@ng-show, 'paragraph.config.tableHide')]"))
                        .isDisplayed(),
                CoreMatchers.equalTo(true));

        // to check if editOnDblClick field is fetched correctly after refresh
        driver.navigate().refresh();
        waitForParagraph(1, "FINISHED");

        action.doubleClick(driver.findElement(By.xpath(getParagraphXPath(1)))).perform();
        ZeppelinITUtils.sleep(1000, false);
        collector.checkThat("Markdown editor is shown after double click ",
                driver.findElement(By
                        .xpath(getParagraphXPath(1) + "//div[contains(@ng-if, 'paragraph.config.editorHide')]"))
                        .isDisplayed(),
                CoreMatchers.equalTo(true));

        collector.checkThat("Markdown editor is hidden after double click ",
                driver.findElement(By.xpath(
                        getParagraphXPath(1) + "//div[contains(@ng-show, 'paragraph.config.tableHide')]"))
                        .isDisplayed(),
                CoreMatchers.equalTo(false));

        deleteTestNotebook(driver);

    } catch (Exception e) {
        handleException("Exception in ParagraphActionsIT while testEditOnDoubleClick ", e);
    }
}

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

License:Apache License

/**
 * Using keyboard arrow keys to get to next page.
 *///w  ww  .  j  a  va 2s.  com
@PerfTest
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.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 w  ww . j a v  a 2s  .c o  m
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.components.ui.inputDate.BaseInputDateUITester.java

License:Apache License

@ExcludeBrowsers({ BrowserType.ANDROID_PHONE, BrowserType.ANDROID_TABLET, BrowserType.IPAD,
        BrowserType.IPHONE })/*www.j a v a 2s.  c  o  m*/
public void testDateWithOneArrow() throws Exception {
    open(URL);
    WebDriver driver = getDriver();

    // Test Begins
    // Getting the calendar Icon
    WebElement element = findDomElement(By.cssSelector(DATE_INPUT_BOX_SEL));
    element.click();
    element.sendKeys("2013-10-01");

    element = findDomElement(By.cssSelector(DATE_ICON_SEL));
    element.click();

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

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

    // Loop through 355 days
    element = loopThroughKeys(element, driver, "" + 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"));
}