Home > Programming, QA, Test and Automation Stuffs > Other ways to turn on or off the caps lock

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 !

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

%d bloggers like this: