Can I use KeyDown command to hold downArrow for a while

In my scenario, there is list with many items, Can I use keyDown command to hold downArrow for a while, so that I can get the end item of list quickly. or vice versa.

Following instructions didn’t work as I expected.

// Try to hold downArrow for 5 seconds

SetOption KeyDownDelay, 5
keyDown downArrow
keyUp downArrow

You nearly had it right, if you change the code to the following

KeyDown DownArrow
wait 5
KeyUp DownArrow

Hi JoostVoeten,

Thanks for you reply but your solution doesn’t work for me, I got same results as before, only one time was moved. I also tried three instructions as below, only got one “f” in terminal.

keyDown “f”
wait 5
keyUp “f”

I forgot to say the SUT under testing is Fedora9.

Joost’s code should definitely work. I just tried your code against the terminal on Ubuntu and got a whole lot of fs.

Does the key repeat in Live Mode? There is a setting in the Keyboard Preferences under Linux for “Key presses repeat when key is held down” (that’s the label on Ubuntu 11); if that’s turned off then you’ll only get one key press.

Hi Matt,
Every thing goes well if I hold down arrow key manually from eggPlant remote viewer or from other VNC Viewer. I don’t have Ubuntu11 in my hand. But I tried this on Ubuntu10.04 after confirmed “Key presses repeat when key is held down” is turned on. Also tried this on Windows XP SUT, Got same results, only one key press.
Until now I can’t get this command running on all three SUTs(Fedora9,Ubuntu10.04, WindowsXP), so I have to doubt my environment is incorrect. I listing them here:
Host: Windows XP with SP3
EggPlant: version 10.3

Are there any configurations of eggPlant impact the “keyDown” command?

I don’t think this is a problem with the KeyDown command. I believe that is doing what is expected in pushing the key down and holding it down.

On a Mac SUT you can see this behavior by running the Keyboard Viewer (enabled from SystemPreferences->Language & Text) and issuing a KeyDown command.

The problem is how the SUT and VNC server are interpreting that event. On some OSes that will produce a repeat, but not always. What is probably happening in live mode is that your LOCAL keyboard driver is noticing that your key is being held down and producing the repeat behavior locally and sending it to the application. I can verify this on my Eggplant machine by enabling/disabling the LOCAL settings for key repeating.

I hope that helps clarify the “key repeat” vs. “key down” behavior. My advice is that if you want to produce a repeated key event you just write a simple script to do it.