Misc Technical | Wednesday, April 8, 2009

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
Up Arrow
112 Opens a new browser page
116 F5 key (Refresh Browser Page)
118 F7 key (Caret Browsing On)
122 F11 key

Join the discussion

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha

Visit the Oracle Blog


Contact Us


Integrated Cloud Applications & Platform Services