Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wires fails to handle ActionChain with Keys #41

Closed
EricRahm opened this issue Jan 22, 2016 · 8 comments
Closed

wires fails to handle ActionChain with Keys #41

EricRahm opened this issue Jan 22, 2016 · 8 comments

Comments

@EricRahm
Copy link

@EricRahm EricRahm commented Jan 22, 2016

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
@lentschi
Copy link

@lentschi lentschi commented Jun 13, 2016

I get the same error without an action chain in wires 0.8 (which has actually been renamed to geckodriver) on Firefox 47, Linux x64. I'm just sending an ENTER key using PHP:

$webDriver->execute(DriverCommand::SEND_KEYS_TO_ACTIVE_ELEMENT, array(
  'value' => array(WebDriverKeys::ENTER),
));

Selenium standalone 2.53.0 fails with:

10:51:51.631 INFO - Done: [click: 0 [[MarionetteDriver: Firefox on LINUX (d1c21b22-b928-4de7-a482-62453da092a5)] -> css selector: #UserUsername]]
10:51:51.633 INFO - Executing: [send keys to active: []])
10:51:51.636 WARN - Exception thrown
org.openqa.selenium.UnsupportedCommandException: POST /session/d1c21b22-b928-4de7-a482-62453da092a5/keys did not match a known command (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 2 milliseconds
Build info: version: '2.53.0', revision: '35ae25b', time: '2016-03-15 17:00:58'
System info: host: 'flomachine', ip: '192.168.1.5', os.name: 'Linux', os.arch: 'amd64', os.version: '3.16.0-73-generic', java.version: '1.7.0_101'
Session ID: d1c21b22-b928-4de7-a482-62453da092a5
Driver info: org.openqa.selenium.firefox.MarionetteDriver
Capabilities [{platform=LINUX, specificationLevel=0, acceptSslCerts=false, browserVersion=47.0, browserName=Firefox, XULappId={ec8030f7-c20a-464f-9b0e-13a3a9e97384}, marionette=true, raisesAccessibilityExceptions=false, rotatable=false, appBuildId=20160606114208, takesElementScreenshot=true, command_id=1, version=47.0, firefox_profile=UEsDBBQAAAAIAHhWzUjf9RXUNAAAA..., platformVersion=3.16.0-73-generic, platformName=Linux, proxy={}, device=desktop, takesScreenshot=true}]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)
    at org.openqa.selenium.remote.RemoteExecuteMethod.execute(RemoteExecuteMethod.java:35)
    at org.openqa.selenium.remote.RemoteKeyboard.sendKeys(RemoteKeyboard.java:35)
    at org.openqa.selenium.support.events.internal.EventFiringKeyboard.sendKeys(EventFiringKeyboard.java:42)
    at org.openqa.selenium.remote.server.handler.interactions.SendKeyToActiveElement.call(SendKeyToActiveElement.java:56)
    at org.openqa.selenium.remote.server.handler.interactions.SendKeyToActiveElement.call(SendKeyToActiveElement.java:1)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:176)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
@andreastt
Copy link
Contributor

@andreastt andreastt commented Jun 13, 2016

Please note that geckodriver implements action pipelining as described in the WebDriver specification, not Selenium.

The part of the specification that talks about actions has not fully been fletched out yet. However, @jgraham is working on it. I have read some early and promising drafts.

For these reasons I’m going to close this ticket as it refers to Selenium-specific behaviour.

@andreastt andreastt closed this Jun 13, 2016
@lentschi
Copy link

@lentschi lentschi commented Jun 13, 2016

@andreastt
Okay - but as I pointed out, the same error occurs without action pipelining: I'm just trying to send a key to the active element. (Or is that selenium specific too...? Sorry, I'm not very familiar with the driver specs.)

I receive the error:
org.openqa.selenium.UnsupportedCommandException: POST /session/d1c21b22-b928-4de7-a482-62453da092a5/keys did not match a known command (WARNING: The server did not provide any stacktrace information) (s. above for the full stack trace)

@jgraham
Copy link
Collaborator

@jgraham jgraham commented Jun 13, 2016

In the webdriver spec the endpoint is /session/{session id}/element/{element id}/sendKeys, so I think this needs to be fixed in Selenium.

@lentschi
Copy link

@lentschi lentschi commented Jun 13, 2016

I see - sorry for complaining about it in the wrong place then!

@andreastt
Copy link
Contributor

@andreastt andreastt commented Jun 13, 2016

@lentschi Yes, @jgraham is correct. Please report back if the same still fails with Element Send Keys.

@jgraham
Copy link
Collaborator

@jgraham jgraham commented Jun 13, 2016

I see - sorry for complaining about it in the wrong place then!

No problem, thanks for reporting the issue! It's hard to tell from the outside when bugs are in selenium or wires or gecko itself.

@lock
Copy link

@lock lock bot commented Aug 17, 2019

This issue has been automatically locked since there has not been any recent activity after it was closed. If you have run into an issue you think is related, please open a new issue.

@lock lock bot locked and limited conversation to collaborators Aug 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.