Skip to content

wires fails to handle ActionChain with Keys #41

@EricRahm

Description

@EricRahm

Attempting to perform an ActionChain containing keys fails in wires 0.6.2 on OS X. It's possible this doesn't work on other platforms and revisions. I am testing against selenium 2.49.2.

Reduced test:

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities

firefox_capabilities = DesiredCapabilities.FIREFOX.copy()
firefox_capabilities['marionette'] = True
firefox_capabilities['binary'] = '/Applications/FirefoxNightly.app/Contents/MacOS/firefox'
driver = webdriver.Firefox(capabilities=firefox_capabilities)

driver.get('data:text/html,<a href="https://mozilla.org">Click This!</a>')
tag = driver.find_element_by_tag_name("a")

# Simulate ctrl-shift clicking the anchor tag.
action = ActionChains(driver)
ctrl_key = Keys.COMMAND # mac
#ctrl_key = Keys.CONTROL # not mac
action.key_down(ctrl_key).key_down(Keys.SHIFT).click(tag).key_up(Keys.SHIFT).key_up(ctrl_key).perform()

Resulting error:

Traceback (most recent call last):
  File "keys_bug.py", line 18, in <module>
    action.key_down(ctrl_key).key_down(Keys.SHIFT).click(tag).key_up(Keys.SHIFT).key_up(ctrl_key).perform()
  File "/Users/ericrahm/dev/comp/venv/lib/python2.7/site-packages/selenium/webdriver/common/action_chains.py", line 72, in perform
    action()
  File "/Users/ericrahm/dev/comp/venv/lib/python2.7/site-packages/selenium/webdriver/common/action_chains.py", line 172, in <lambda>
    "value": self._keys_to_typing(value) }))
  File "/Users/ericrahm/dev/comp/venv/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 201, in execute
    self.error_handler.check_response(response)
  File "/Users/ericrahm/dev/comp/venv/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 188, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: POST /session/c538f756-c6d7-fc45-a3d8-bfe0803c71a8/keys did not match a known command

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions