w3c / w3c/webdriver

Diverging driver behavior for "clear the modifier key state" in "Dispatch actions for a string"

Open
#1,734 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Element Send Keys Perform Actions
Dominant language
HTML
Stars
718
Forks
228
PR merge metrics
No merged PRs in 30d

Description

As per the Dispatch actions for a string definition in the WebDriver classic spec the modifier key state should only be reset when the NULL key is send. But drivers behave differently these days for the following Selenium test:

def test_modifier_keys(driver):
    driver.get(inline('<input id="input" type="text" value="foo">'))
    elem = driver.find_element(By.ID, "input")
    elem.send_keys(Keys.META + 'a' + Keys.META + Keys.DELETE + "cheese")
    assert elem.get_property("value") == 'cheese'

Per definition the META key should be kept in pressed state and as such cheese should not be the final value of the send_keys command. But here the results of the browsers:

  1. Chrome passes the above assertion, which means the META modifier key has been reset.

  2. Firefox fails this assertion with foo != cheese, which is the cause of a regression in Firefox 99, which we are going to fix for now to have a similar behavior as Chrome.

  3. I wasn't able to test Safari.

We should discuss what the correct behavior should be and then align the WebDriver implementations on the spec. If we think that we should not do such a change, maybe we should add that using the modifier key again resets the state of that particular modifier.

CC @jgraham, @sadym-chromium.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the WebDriver classic specification's “Dispatch actions for a string” definition and the Selenium test_modifier_keys example in the issue. Compare the stated NULL-key rule with the Chrome and Firefox results, then review the linked Firefox regression. Done means the expected modifier-key behavior is decided and the relevant WebDriver implementations are aligned.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.