Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know there is an action class where this is possible, but I just understand common keys, such as: enter, backspace, and tab. For instance:

action.sendKeys (Keys.ENTER).perform();

For modifier keys---Caps Lock, Control, Option, Command---it is not very clear how to use sendKeys?

share|improve this question

The following might help:

Based on that, you can create a function, which can simulate caps lock ON e.g.

(just a rough function)

def send_caps_keys(keys):
  for key in keys:
    element.send_keys [:shift, key]
share|improve this answer

Thank you for your timely reply, but I can not find specific examples.

I was just learning the selenium, can you give me an example?

How simulate keystrokes Caps Lock key?

such as pressing the enter key: action.sendKeys (Keys.ENTER). perform ();*



share|improve this answer
Welcome to SQA Devin. This is response to user246's comment on your question, and you can just "add comment" rather than posting it as an answer. – Suchit Parikh Aug 28 '13 at 16:43
@SuchitParikh I think it's actually a response to Sam's answer. – corsiKa Aug 28 '13 at 17:27
@Devin Who were you trying to respond to? You should comment on that answer or your question to respond to comments. I'd be happy to migrate it for you if I know where it has to go. – corsiKa Aug 28 '13 at 17:28
@CorsiKa Thanks. Before I want to try to reply@sam-woods, Seems it's my IE browser problems, I couldn't add comments. Now it's OK. – Devin Sep 1 '13 at 10:11

Maybe this will help get you started. You can hack in a caps lock key into selenium/webdriver/common/ In the Keys class I added the following line:

CAPS         = '\ue21EA'

Then I fired up webdriver and pointed it at a JavaScript Caps Lock detector

I found the element and sent it the CAPS key. Then the webpage returned a caps lock warning

x = driver.find_element_by_name('password')

If your goal is checking whether caps lock is on or off, this should help.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.