Closed Bug 1419393 Opened 2 years ago Closed 2 years ago

send_keys() synthesizes a keyCode of 0 for some events (keypress)

Categories

(Testing :: Marionette, defect)

Version 3
defect
Not set

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: whimboo, Unassigned)

References

(Depends on 1 open bug, Blocks 1 open bug)

Details

Here the sequence for form elements when using `send_keys("F")`:

    {
      "type": "keydown",
      "keyCode": 70,
      "content": ""
    },
    {
      "type": "keypress",
      "keyCode": 0,
      "content": ""
    },
    {
      "type": "input",
      "keyCode": null,
      "content": "F"
    },
    {
      "type": "keyup",
      "keyCode": 70,
      "content": "F"
    }

Events like `keydown`, `keypress`, and `keyup` should contain the same key code. But this is not the case for `keypress` here. 

This might need bug 1418995 being fixed.
(In reply to Henrik Skupin (:whimboo) from comment #0)
> Events like `keydown`, `keypress`, and `keyup` should contain the same key
> code. But this is not the case for `keypress` here. 

That's not true for Firefox. Check what Firefox actually does here: https://dvcs.w3.org/hg/d4e/raw-file/tip/key-event-test.html -- you'll see that keyCode is 0 with keyPress in Firefox. See also https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode -- the 0 is by design.
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.