Example usage for org.openqa.selenium Keys PAGE_UP

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

Introduction

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

Prototype

Keys PAGE_UP

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

Click Source Link

Usage

From source file:com.cisco.dbds.utils.primewidgets.primewidgetsStepDef.java

License:Open Source License

@Given("^Scroll down or up$")
public void scroll_down() throws NoSuchMethodException, SecurityException, ClassNotFoundException,
        IllegalAccessException, IllegalArgumentException, InvocationTargetException {
    //   WebElement we = SeleniumUtilities.findElement(Identifier.XPATH, ".//label[normalize-space(text())='Users and Groups']");
    //   WebElement scroll = SeleniumUtilities.findElement(Identifier.XPATH, ".//label[contains(normalize-space(text()),'Users and Groups')]");
    WebElement scroll = primewuipf.SETTINGS_BUTTON_WE_XPATH;
    scroll.sendKeys(Keys.PAGE_UP);
    //   SeleniumUtilities.scroll(we, 100);
    //   WebElement element = driver.findElement(By.id("id_of_element"));
    //   JavascriptExecutor js = (JavascriptExecutor) (SeleniumUtilities.getDriver());
    ((JavascriptExecutor) SeleniumUtilities.getDriver()).executeScript("arguments[0].scrollIntoView(true);",
            scroll);//from  w w w  . j a va  2  s . com
}

From source file:com.gargoylesoftware.htmlunit.selenium.TypingTest.java

License:Apache License

/**
 * A test.//from   w ww  .j a  v a2  s .  c om
 */
@Test
public void testArrowKeysAndPageUpAndDown() {
    final WebDriver driver = getWebDriver("/javascriptPage.html");

    final WebElement element = driver.findElement(By.id("keyReporter"));

    element.sendKeys(
            "a" + Keys.LEFT + "b" + Keys.RIGHT + Keys.UP + Keys.DOWN + Keys.PAGE_UP + Keys.PAGE_DOWN + "1");
    assertThat(element.getAttribute("value"), is("ba1"));
}

From source file:com.gargoylesoftware.htmlunit.selenium.TypingTest.java

License:Apache License

/**
 * A test.//from   w w  w .j  a  v a 2s  .c o m
 */
@Test
public void homeAndEndAndPageUpAndPageDownKeys() {
    final WebDriver driver = getWebDriver("/javascriptPage.html");

    final WebElement element = driver.findElement(By.id("keyReporter"));

    element.sendKeys("abc" + Keys.HOME + "0" + Keys.LEFT + Keys.RIGHT + Keys.PAGE_UP + Keys.PAGE_DOWN + Keys.END
            + "1" + Keys.HOME + "0" + Keys.PAGE_UP + Keys.END + "111" + Keys.HOME + "00");
    assertThat(element.getAttribute("value"), is("0000abc1111"));
}

From source file:com.thoughtworks.selenium.webdriven.commands.SendKeys.java

License:Apache License

@Override
protected Void handleSeleneseCommand(WebDriver driver, String locator, String value) {
    alertOverride.replaceAlertMethod(driver);

    value = value.replace("${KEY_ALT}", Keys.ALT);
    value = value.replace("${KEY_CONTROL}", Keys.CONTROL);
    value = value.replace("${KEY_CTRL}", Keys.CONTROL);
    value = value.replace("${KEY_META}", Keys.META);
    value = value.replace("${KEY_COMMAND}", Keys.COMMAND);
    value = value.replace("${KEY_SHIFT}", Keys.SHIFT);

    value = value.replace("${KEY_BACKSPACE}", Keys.BACK_SPACE);
    value = value.replace("${KEY_BKSP}", Keys.BACK_SPACE);
    value = value.replace("${KEY_DELETE}", Keys.DELETE);
    value = value.replace("${KEY_DEL}", Keys.DELETE);
    value = value.replace("${KEY_ENTER}", Keys.ENTER);
    value = value.replace("${KEY_EQUALS}", Keys.EQUALS);
    value = value.replace("${KEY_ESCAPE}", Keys.ESCAPE);
    value = value.replace("${KEY_ESC}", Keys.ESCAPE);
    value = value.replace("${KEY_INSERT}", Keys.INSERT);
    value = value.replace("${KEY_INS}", Keys.INSERT);
    value = value.replace("${KEY_PAUSE}", Keys.PAUSE);
    value = value.replace("${KEY_SEMICOLON}", Keys.SEMICOLON);
    value = value.replace("${KEY_SPACE}", Keys.SPACE);
    value = value.replace("${KEY_TAB}", Keys.TAB);

    value = value.replace("${KEY_LEFT}", Keys.LEFT);
    value = value.replace("${KEY_UP}", Keys.UP);
    value = value.replace("${KEY_RIGHT}", Keys.RIGHT);
    value = value.replace("${KEY_DOWN}", Keys.DOWN);
    value = value.replace("${KEY_PAGE_UP}", Keys.PAGE_UP);
    value = value.replace("${KEY_PGUP}", Keys.PAGE_UP);
    value = value.replace("${KEY_PAGE_DOWN}", Keys.PAGE_DOWN);
    value = value.replace("${KEY_PGDN}", Keys.PAGE_DOWN);
    value = value.replace("${KEY_END}", Keys.END);
    value = value.replace("${KEY_HOME}", Keys.HOME);

    value = value.replace("${KEY_NUMPAD0}", Keys.NUMPAD0);
    value = value.replace("${KEY_N0}", Keys.NUMPAD0);
    value = value.replace("${KEY_NUMPAD1}", Keys.NUMPAD1);
    value = value.replace("${KEY_N1}", Keys.NUMPAD1);
    value = value.replace("${KEY_NUMPAD2}", Keys.NUMPAD2);
    value = value.replace("${KEY_N2}", Keys.NUMPAD2);
    value = value.replace("${KEY_NUMPAD3}", Keys.NUMPAD3);
    value = value.replace("${KEY_N3}", Keys.NUMPAD3);
    value = value.replace("${KEY_NUMPAD4}", Keys.NUMPAD4);
    value = value.replace("${KEY_N4}", Keys.NUMPAD4);
    value = value.replace("${KEY_NUMPAD5}", Keys.NUMPAD5);
    value = value.replace("${KEY_N5}", Keys.NUMPAD5);
    value = value.replace("${KEY_NUMPAD6}", Keys.NUMPAD6);
    value = value.replace("${KEY_N6}", Keys.NUMPAD6);
    value = value.replace("${KEY_NUMPAD7}", Keys.NUMPAD7);
    value = value.replace("${KEY_N7}", Keys.NUMPAD7);
    value = value.replace("${KEY_NUMPAD8}", Keys.NUMPAD8);
    value = value.replace("${KEY_N8}", Keys.NUMPAD8);
    value = value.replace("${KEY_NUMPAD9}", Keys.NUMPAD9);
    value = value.replace("${KEY_N9}", Keys.NUMPAD9);
    value = value.replace("${KEY_ADD}", Keys.ADD);
    value = value.replace("${KEY_NUM_PLUS}", Keys.ADD);
    value = value.replace("${KEY_DECIMAL}", Keys.DECIMAL);
    value = value.replace("${KEY_NUM_PERIOD}", Keys.DECIMAL);
    value = value.replace("${KEY_DIVIDE}", Keys.DIVIDE);
    value = value.replace("${KEY_NUM_DIVISION}", Keys.DIVIDE);
    value = value.replace("${KEY_MULTIPLY}", Keys.MULTIPLY);
    value = value.replace("${KEY_NUM_MULTIPLY}", Keys.MULTIPLY);
    value = value.replace("${KEY_SEPARATOR}", Keys.SEPARATOR);
    value = value.replace("${KEY_SEP}", Keys.SEPARATOR);
    value = value.replace("${KEY_SUBTRACT}", Keys.SUBTRACT);
    value = value.replace("${KEY_NUM_MINUS}", Keys.SUBTRACT);

    value = value.replace("${KEY_F1}", Keys.F1);
    value = value.replace("${KEY_F2}", Keys.F2);
    value = value.replace("${KEY_F3}", Keys.F3);
    value = value.replace("${KEY_F4}", Keys.F4);
    value = value.replace("${KEY_F5}", Keys.F5);
    value = value.replace("${KEY_F6}", Keys.F6);
    value = value.replace("${KEY_F7}", Keys.F7);
    value = value.replace("${KEY_F8}", Keys.F8);
    value = value.replace("${KEY_F9}", Keys.F9);
    value = value.replace("${KEY_F10}", Keys.F10);
    value = value.replace("${KEY_F11}", Keys.F11);
    value = value.replace("${KEY_F12}", Keys.F12);

    finder.findElement(driver, locator).sendKeys(value);

    return null;//from w  ww.j av  a2s .c o  m
}

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

License:Apache License

@Test
public void testPageUpPageDown() throws Exception {
    openTestURL();/*from www.  j a  va 2 s  . c  o m*/

    selectMenuPath("Component", "Size", "HeightMode Row");

    getGridElement().getCell(9, 2).click();
    new Actions(getDriver()).sendKeys(Keys.PAGE_DOWN).perform();
    assertTrue("Row 17 did not become visible", isElementPresent(By.xpath("//td[text() = '(17, 2)']")));

    new Actions(getDriver()).sendKeys(Keys.PAGE_DOWN).perform();
    assertTrue("Row 25 did not become visible", isElementPresent(By.xpath("//td[text() = '(25, 2)']")));
    checkFocusedCell(29, 2, 4);

    getGridElement().getCell(41, 2).click();
    new Actions(getDriver()).sendKeys(Keys.PAGE_UP).perform();
    assertTrue("Row 33 did not become visible", isElementPresent(By.xpath("//td[text() = '(33, 2)']")));

    new Actions(getDriver()).sendKeys(Keys.PAGE_UP).perform();
    assertTrue("Row 25 did not become visible", isElementPresent(By.xpath("//td[text() = '(25, 2)']")));
    checkFocusedCell(21, 2, 4);
}

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

License:Apache License

@ExcludeBrowsers({ BrowserType.IE9, BrowserType.IE10, BrowserType.ANDROID_PHONE, BrowserType.ANDROID_TABLET,
        BrowserType.IPAD, BrowserType.IPHONE })
public void testPageUpDownYear() throws Exception {
    DateFormat formatter = new SimpleDateFormat(DATE_FORMAT_STR);
    open(URL);//from  ww  w . j a va  2s. c  om
    // Calendar used to get current date
    GregorianCalendar cal = new GregorianCalendar();
    // Running test, Increasing year
    String result = pageUpDownHelper(10, Keys.SHIFT + "" + Keys.PAGE_UP);

    // Moving calendar to match corresponding action of test and formatting date
    cal.setTime(formatter.parse(TEST_DATE_TO_USE));
    cal.add(Calendar.YEAR, -10);

    // Formatting date to match out of test
    String fmt = new SimpleDateFormat(DATE_FORMAT_STR).format(cal.getTime());

    // Making sure test result and true calendar outcome match
    assertEquals("Shift + Page up did not go to the correct date", fmt, result);

    // Resetting calendar
    cal = new GregorianCalendar();

    // Running test, decreasing month
    result = pageUpDownHelper(15, Keys.SHIFT + "" + Keys.PAGE_DOWN);

    // Moving calendar to match corresponding action of test and formatting date
    cal.setTime(formatter.parse(TEST_DATE_TO_USE));
    cal.add(Calendar.YEAR, 15);
    fmt = new SimpleDateFormat(DATE_FORMAT_STR).format(cal.getTime());

    // Making sure test result and true calendar outcome match
    assertEquals("shift + Page Down did not find the correct date", fmt, result);
}

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 ww  . j  a v  a2 s. c o  m
public void testPageUpDownMonth() throws Exception {
    DateFormat formatter = new SimpleDateFormat(DATE_FORMAT_STR);
    open(URL);

    // Calendar used to get current date
    GregorianCalendar cal = new GregorianCalendar();

    // Running test, Decreasing month
    String result = pageUpDownHelper(4, "" + Keys.PAGE_UP);

    // Moving calendar to match corresponding action of test and formatting date
    cal.setTime(formatter.parse(TEST_DATE_TO_USE));
    cal.add(Calendar.MONTH, -4);
    String fmt = new SimpleDateFormat(DATE_FORMAT_STR).format(cal.getTime());
    assertEquals("Page up id not find the correct date", fmt, result);

    // Resetting calendar
    cal = new GregorianCalendar();

    // Running Test, increasing month
    result = pageUpDownHelper(10, "" + Keys.PAGE_DOWN);

    // Moving calendar to match corresponding action of test and formatting date
    cal.setTime(formatter.parse(TEST_DATE_TO_USE));
    cal.add(Calendar.MONTH, 10);
    fmt = new SimpleDateFormat(DATE_FORMAT_STR).format(cal.getTime());

    // Making sure test result and true calendar outcome match
    assertEquals("Page down id not find the correct date", fmt, result);
}

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

License:Apache License

@ExcludeBrowsers({ BrowserType.IE7, BrowserType.IE9, BrowserType.IE10, BrowserType.ANDROID_PHONE,
        BrowserType.ANDROID_TABLET, BrowserType.IPAD, BrowserType.IPHONE })
public void testPageUpDownYear() throws Exception {
    DateFormat formatter = new SimpleDateFormat(DATE_FORMAT_STR);
    open(URL);//  www .  j av a  2 s .  c  o m
    // Calendar used to get current date
    GregorianCalendar cal = new GregorianCalendar();
    // Running test, Increasing year
    String result = pageUpDownHelper(10, Keys.SHIFT + "" + Keys.PAGE_UP);

    // Moving calendar to match corresponding action of test and formatting date
    cal.setTime(formatter.parse(TEST_DATE_TO_USE));
    cal.add(Calendar.YEAR, -10);

    // Formatting date to match out of test
    String fmt = new SimpleDateFormat(DATE_FORMAT_STR).format(cal.getTime());

    // Making sure test result and true calendar outcome match
    assertEquals("Shift + Page up did not go to the correct date", fmt, result);

    // Resetting calendar
    cal = new GregorianCalendar();

    // Running test, decreasing month
    result = pageUpDownHelper(15, Keys.SHIFT + "" + Keys.PAGE_DOWN);

    // Moving calendar to match corresponding action of test and formatting date
    cal.setTime(formatter.parse(TEST_DATE_TO_USE));
    cal.add(Calendar.YEAR, 15);
    fmt = new SimpleDateFormat(DATE_FORMAT_STR).format(cal.getTime());

    // Making sure test result and true calendar outcome match
    assertEquals("shift + Page Down did not find the correct date", fmt, result);
}

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

License:Apache License

@ExcludeBrowsers({ BrowserType.IE7, BrowserType.IE9, BrowserType.IE10, BrowserType.IE11,
        BrowserType.ANDROID_PHONE, BrowserType.ANDROID_TABLET, BrowserType.IPAD, BrowserType.IPHONE })
@Test/*from w  ww. j  a v a  2 s .  c om*/
public void testPageUpDownYear() throws Exception {
    DateFormat formatter = new SimpleDateFormat(DATE_FORMAT_STR);
    open(URL);
    // Calendar used to get current date
    GregorianCalendar cal = new GregorianCalendar();
    // Running test, Increasing year
    String result = pageUpDownHelper(10, Keys.SHIFT + "" + Keys.PAGE_UP);

    // Moving calendar to match corresponding action of test and formatting date
    cal.setTime(formatter.parse(TEST_DATE_TO_USE));
    cal.add(Calendar.YEAR, -10);

    // Formatting date to match out of test
    String fmt = new SimpleDateFormat(DATE_FORMAT_STR).format(cal.getTime());

    // Making sure test result and true calendar outcome match
    assertEquals("Shift + Page up did not go to the correct date", fmt, result.trim());

    // Resetting calendar
    cal = new GregorianCalendar();

    // Running test, decreasing month
    result = pageUpDownHelper(15, Keys.SHIFT + "" + Keys.PAGE_DOWN);

    // Moving calendar to match corresponding action of test and formatting date
    cal.setTime(formatter.parse(TEST_DATE_TO_USE));
    cal.add(Calendar.YEAR, 15);
    fmt = new SimpleDateFormat(DATE_FORMAT_STR).format(cal.getTime());

    // Making sure test result and true calendar outcome match
    assertEquals("shift + Page Down did not find the correct date", fmt, result.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 })/*from  w ww  .  j a  v  a2 s  .c  om*/
public void _testPageUpDownMonth() throws Exception {
    DateFormat formatter = new SimpleDateFormat(DATE_FORMAT_STR);
    open(URL);

    // Calendar used to get current date
    GregorianCalendar cal = new GregorianCalendar();

    // Running test, Decreasing month
    String result = pageUpDownHelper(4, "" + Keys.PAGE_UP);

    // Moving calendar to match corresponding action of test and formatting date
    cal.setTime(formatter.parse(TEST_DATE_TO_USE));
    cal.add(Calendar.MONTH, -4);
    String fmt = new SimpleDateFormat(DATE_FORMAT_STR).format(cal.getTime());
    assertEquals("Page up id not find the correct date", fmt, result.trim());

    // Resetting calendar
    cal = new GregorianCalendar();

    // Running Test, increasing month
    result = pageUpDownHelper(10, "" + Keys.PAGE_DOWN);

    // Moving calendar to match corresponding action of test and formatting date
    cal.setTime(formatter.parse(TEST_DATE_TO_USE));
    cal.add(Calendar.MONTH, 10);
    fmt = new SimpleDateFormat(DATE_FORMAT_STR).format(cal.getTime());

    // Making sure test result and true calendar outcome match
    assertEquals("Page down id not find the correct date", fmt, result.trim());
}