[dojo-contributors] selenium vs. windmill

Mark Hays haysmark at us.ibm.com
Thu May 29 10:34:11 EDT 2008

Think of doh.keyPress in terms of JavaScript onkeypress events and 
Windmill/Selenium's triggerKeyEvent: for any key event, you have a 
charCode, a keyCode, and flags showing you whether alt, ctrl, and/or shift 
were pressed. So you call a doh.keyPress like this:
doh.keyPress(charCode, keyCode, altpressed, ctrlpressed, shiftpressed)

So for instance, tab is keyCode 9 and doesn't require any alt/ctrl/shift 
keys, so you call:
doh.keyPress(9, 9, false, false, false)

Similarly, to shift-tab, you just set shift to true:
doh.keyPress(9, 9, false, false, true)

doh.keyPress automatically releases the key after you press it (Java's 
keyPress only sticks in Safari anyway; IE and Firefox release the key Java 
pressed themselves), so I didn't make a keyRelease. I could though if you 
want it.. Java doesn't provide "just" a keyDown (how would you do that on 
a real keyboard without a keyPress?) so I didn't make one. That would be 
something we would have to create using synthetic events in JS.

David Bolter <david.bolter at utoronto.ca> 
Sent by: dojo-contributors-bounces at dojotoolkit.org
05/28/2008 08:18 PM
Please respond to
"dojo dev." <dojo-contributors at dojotoolkit.org>

"dojo dev." <dojo-contributors at dojotoolkit.org>

Re: [dojo-contributors] selenium vs. windmill

Neat. Can you describe doh.keyPress a little more?  Is there also a 
keyDown and keyUp, or are those flags in keyPress?

Anyways, this will be very handy!  I had cleared my morning tomorrow 
(seriously, it is in my google calendar) to work on just this kind of 
thing so I'm glad you sent this email!

Please ref http://trac.dojotoolkit.org/ticket/3486 on related commits. 
Is there another ticket I should watch?


Douglas Hays wrote:
> Mark and I have been working on a doh function that can type keys 
> (including tabs
> that really change focus). It's a work in progress but you can see it 
> in action:

> <
> The first time you run it, you'll get a popup to allow code from Mark 
> Hays to run.
> You should answer yes and then you may need to push refresh since the 
> test doesn't block
> for this dialog.
> The test doesn't do much and only lasts a few seconds but you can see 
> tab/focus occurring and the keys being typed (we slowed down the keys 
> for effect,
> not neccesity).
> The goal was to separate out the keyboard function from the 
> selenium/windmill discussion.
> So now we only need selenium's grid to test on multiple browsers and 
> we can use
> doh to do everything else.
> ------------------------------------------------------------------------
> _______________________________________________
> dojo-contributors mailing list
> dojo-contributors at dojotoolkit.org
> http://turtle.dojotoolkit.org/mailman/listinfo/dojo-contributors

dojo-contributors mailing list
dojo-contributors at dojotoolkit.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.dojotoolkit.org/pipermail/dojo-contributors/attachments/20080529/dc28fa87/attachment.htm 

More information about the dojo-contributors mailing list