Need to simulate a keyboard event down arrow.

176 views
Skip to first unread message

Tom

unread,
Feb 8, 2008, 5:03:09 PM2/8/08
to selenium-users...@googlegroups.com
DISCLAIMER: Yes I've read the thread on trying to select text using the left arrow key..I think this is somewhat different so I'm posing my own question.

Hello,
I've been trying to simulate a down arrow being pressed on the keyboard and I'm wondering if anyone has figured out how to do this yet. keyPress, keyDown + keyUp and type all seem to just ignore my command.

I have a situation where typing in a field produces a list of auto-corrections directly below the field. When a user presses the down arrow on the keyboard it selects the first auto-correction. The user can then traverse through the list of possible corrections using the down and up arrow keys. A fairly common feature for searching webpages within a site. However, I can't seem to get selenium to press the down arrow.

I've tried:
selenium.keyPress("textField", "\25"); //ascii for down arrow
selenium.keyPress("textField", "\40"); //supposedly the javascript equivalent of down arrow according to http://www.cambiaresearch.com

I've tried the type, keyDown, and keyUp methods. Selenium doesn't come back with any errors..just simply runs the command and smiles at me while I try desperately not to throw something through my monitor.

I'm running selenium with Java. Any help would be great!

-T

Tom

unread,
Feb 8, 2008, 5:15:45 PM2/8/08
to selenium-users...@googlegroups.com
OMG, someone slap me!

java escapes the backslash...

solution:
selenium.keyDown("textField", "\\ 40");
selenium.keyUp("textField", "\\ 40");

gg..I'm gonna go cry now.


hmm...this forum escapes double backslash...its not a new line its two backslashes..ugh.

-T

Edited by: transverse on Feb 8, 2008 4:16 PM

Reply all
Reply to author
Forward
0 new messages