View Javadoc

1   package com.atlassian.pageobjects.elements;
2   
3   /**
4    * <p/>
5    * Encapsulates Javascript keyboard element events of the {@link com.atlassian.pageobjects.elements.PageElement}.
6    *
7    * <p/>
8    * {@link PageElement#isPresent()} of the corresponding page element must return <code>true</code>
9    * before any of the methods of this interface are invoked, otherwise {@link org.openqa.selenium.NoSuchElementException}
10   * will be raised.
11   *
12   * <p/>
13   * NOTE: all events invoked via this class are pure Javascript events and don't simulate the real user-browser
14   * interaction. The standard real-browser interaction is that for each pressed key a set of 'keydown', 'keypress' and
15   * 'keyup' events is triggered.
16   *
17   * <p/>
18   * NOTE: clients are responsible for providing appropriate key codes for spacial keys for each event. See e.g.
19   * http://unixpapa.com/js/key.html.
20   *
21   * <p/>
22   * Use this class primarily as workaround when standard methods in
23   * {@link com.atlassian.pageobjects.elements.PageElement} simulating user interaction don't produce desired results.
24   *
25   * @since 2.1
26   */
27  public interface PageElementKeyboardJavascript
28  {
29      /**
30       * Dispatches a 'keydown' event to the associated element.
31       *
32       * @param keyCode key code
33       * @return the associated Javascript object
34       */
35      PageElementJavascript keyDown(int keyCode);
36  
37      /**
38       * <p/>
39       * Dispatches a 'keypress' event to the associated element.
40       *
41       * @param keyCode key code
42       * @return the associated Javascript object
43       */
44      PageElementJavascript keyPress(int keyCode);
45  
46      /**
47       * <p/>
48       * Dispatches a 'keydown' event to the associated element.
49       *
50       * @param keyCode key code
51       * @return the associated Javascript object
52       */
53      PageElementJavascript keyUp(int keyCode);
54  
55  }