webdriver icon indicating copy to clipboard operation
webdriver copied to clipboard

Element Send Keys always resets shift key for lowercase letters

Open whimboo opened this issue 7 years ago • 4 comments

While implementing Element Send Keys to use the action primitives in Marionette I noticed a misbehavior in how modifier keys are handled. Especially here the Shift key.

Take the following example:

elem.send_keys("ab" + Keys.SHIFT + "cd" + Keys.SHIFT + "ef")

This produced a value of abCDef for the element. But this combination doesn't work with the spec anymore because of chapter 14. Element Interaction, section 14.3 Element Send Keys:

If char is not a shifted character and the shifted state of keyboard is true, create a new action object with keyboard's id, "key", and "keyUp", and set its value property to U+E008 ("left shift"). Dispatch a keyUp action with this action object and keyboard's key input state.

That means that we always reset the shift key status now, when a lowercase letter is send. And that even with the shift key just activated.

whimboo avatar Oct 24 '18 14:10 whimboo