selenium-google-code-issue-archive icon indicating copy to clipboard operation
selenium-google-code-issue-archive copied to clipboard

Cannot send multiple send_keys actions with modifier keys

Open lukeis opened this issue 8 years ago • 2 comments

Originally reported on Google Code with ID 7930

What steps will reproduce the problem?

1. Run the attached test script - essentially this types abc into the text field with
the shift modifier key pressed and then repeats the action again

What is the expected output? 

The text should appear in the field as ABCABC. The shift key should be pressed for
both actions

What do you see instead?

The text appears as ABCabc. The shift key has only been pressed for the first action


Selenium version: 2.43.0 (Python bindings)
OS: Windows 7
Browser: Firefox 
Browser version: 31 (ESR)

Reported by stevejeffers on 2014-09-18 15:30:14


- _Attachment: [webdriver_send_keys_bug.py](https://storage.googleapis.com/google-code-attachments/selenium/issue-7930/comment-0/webdriver_send_keys_bug.py)_

lukeis avatar Mar 04 '16 08:03 lukeis

It is working as expected, ActionChains.send_keys does not (and should not) implicitly
release modifiers.

To release modifiers one can call send_keys(Keys.NULL) explicitly:

ActionChains(driver)\
    .click(field)\
    .send_keys(Keys.SHIFT,"abc",Keys.NULL)\
    .perform()

ActionChains(driver)\
    .click(field)\
    .send_keys(Keys.SHIFT,"abc",Keys.NULL)\
    .perform()

But the is a problem yet: it is not covered by python binding documentation.

Reported by barancev on 2014-09-22 12:26:11

  • Status changed: Accepted
  • Labels added: Lang-Python, Component-Docs

lukeis avatar Mar 04 '16 08:03 lukeis

Reported by luke.semerau on 2015-09-17 17:47:05

  • Labels added: Restrict-AddIssueComment-Commit

lukeis avatar Mar 04 '16 08:03 lukeis