Other ways to turn on or off the caps lock

Turn on/off the Caps lock with Selenium RC and key press and key up:

selenium.keyUpNative(KeyEvent.VK_CAPS_LOCK.toString()); // Turn off the caps Lock, you can use this if ou don’t know if the caps lock is on or off. So you can turn off before you press the key.

selenium.keyPressNative(KeyEvent.VK_CAPS_LOCK.toString()); //Β Turn on the caps lock

With the Robot:

Robot robo = new Robot();
robo.keyPress(KeyEvent.VK_CAPS_LOCK);

Very easy, and if one way doesn`t work, you can try another πŸ™‚

Bye bye !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.