KeyBoard Events in Selenium

Requirement : Need to press "Page Down" key during one of the selenium tests

Solution:  Use typeKeys(locator,value) command to generate a keystroke event.  
In some cases, you may need to use the simple "type" command to set the value of the field and then the "typeKeys" command to send the keystroke events corresponding to what you just typed.

locator can be '//' in this case
value can be the ASCII value of the keyboard keys. Refer the below table for examples

8 Brower Back Button
32 SpaceBar Key (also Page Down key)
33 Shift+SpaceBar key (also Page Up key)
34 (or) 35 (or) 36 Page Down key
38
Up Arrow
112 Opens a new browser page
116 F5 key (Refresh Browser Page)
118 F7 key (Caret Browsing On)
122 F11 key

Comments:

Post a Comment:
Comments are closed for this entry.
About

I'm a Quality Engineer at Sun Microsystems. Here in this blog, you may find information about Software Testing, Portal Server, Virtualization, Web2.0 and Misc Technical topics. The views expressed here are personal and does not reflect that of my employer

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today