Skip to content

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

Open
@whimboo

Description

@whimboo

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions