SeleniumHQ / selenium

A browser automation framework and ecosystem.
https://selenium.dev
Apache License 2.0
30.72k stars 8.19k forks source link

JsonWire: Unexpected error on command sendKeys #2160

Closed edno closed 8 years ago

edno commented 8 years ago

Meta -

OS: Mac OS X 10.11.4 x86_64 Selenium Version: v2.53.0, with Core v2.53.0. Built from revision 35ae25b Browser: Firefox Browser Version: 46.0.1 (64-bit)

Expected Behavior -

The command sendKeys should populate the targeted field with keys from the string passed in parameter. Reference W3C WebDriver

Actual Behavior -

The command sendKeys terminates with an error, without sending the keys to the browser.

{
  "state": "unhandled error",
  "sessionId": null,
  "hCode": 1167126709,
  "value": {
    "additionalInformation": "\nDriver info: driver.version: unknown",
    "localizedMessage": "POST /session/b3ae7d05-176c-4479-b67e-faf7e1e0204b/element/0/sendKeys\nBuild info: version: '2.53.0', revision: '35ae25b', time: '2016-03-15 17:00:58'\nSystem info: host: 'xxxxxxxxx.local', ip: 'xx.xx.xx.xx', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11.4', java.version: '1.8.0_91'\nDriver info: driver.version: unknown",
    "supportUrl": null,
    "systemInformation": "System info: host: 'xxxxxxxxx.local', ip: 'xx.xx.xx.xx', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11.4', java.version: '1.8.0_91'",
    "cause": null,
    "stackTrace": [
      null,
      null,
      null,
      null,
      null,
      null,
      null,
      null,
      null,
      null,
      null,
      null,
      null,
      null,
      null,
      null,
      null,
      null,
      null
    ],
    "suppressed": [],
    "message": "POST /session/b3ae7d05-176c-4479-b67e-faf7e1e0204b/element/0/sendKeys\nBuild info: version: '2.53.0', revision: '35ae25b', time: '2016-03-15 17:00:58'\nSystem info: host: 'xxxxxxxxx.local', ip: 'xx.xx.xx.xx', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11.4', java.version: '1.8.0_91'\nDriver info: driver.version: unknown",
    "hCode": 774560526,
    "class": "org.openqa.selenium.UnsupportedCommandException",
    "buildInformation": null
  },
  "class": "org.openqa.selenium.remote.Response",
  "status": 13
}

The server debug logs does not provide any relevant information: 18:46:55.766 DEBUG [15] org.openqa.selenium.remote.server.DriverServlet - Handling: POST /session/b3ae7d05-176c-4479-b67e-faf7e1e0204b/element/0/sendKeys 18:46:55.766 DEBUG [15] org.openqa.selenium.remote.server.DriverServlet - Error on: POST /session/b3ae7d05-176c-4479-b67e-faf7e1e0204b/element/0/sendKeys

Steps to reproduce -

Using REST client (e.g. Postman for Chrome), setup a new session and send keys to an input field: http://127.0.0.1:4444/wd/hub/session/:sessionId:/element/0/sendKeys { "value": "shoes" } I have tested using "text" instead of "value" as a parameter, also tested using array char instead of string.

lukeis commented 8 years ago

Here's an example payload that the python bindings send when connecting directly with FirefoxDriver:

http://127.0.0.1:50783/hub/session/8b99b3d0-6456-df4b-8341-9806d28f9e69/element/{ecf9cf26-79a4-bd46-8d7c-25c8905f4959}/value
{"sessionId": "8b99b3d0-6456-df4b-8341-9806d28f9e69", "id": "{ecf9cf26-79a4-bd46-8d7c-25c8905f4959}", "value": ["s", "h", "o", "e", "s"]}

We currently only support using one of our language bindings provided: java / .NET / python / ruby / nodejs If you can reproduce the issue with one of those we'd be much more inclined to look into a potential send_keys bug with the driver implementation. Otherwise if you're writing your own client, I highly recommend looking at one of the ones we do maintain to compare with your own.

lukeis commented 8 years ago

Also it would appear that you are attempting to use strictly the W3C protocol... which is not implemented in the Selenium project's FirefoxDriver. You might have better luck trying against marionette from Mozilla instead?

edno commented 8 years ago

Thanks for the quick reply. You're right, I'm following the W3C reference just because that's what is recommended on the wiki 😥 I'm not familiar with Marionette but I'll have a look at it.

jleyba commented 8 years ago

The Selenium wiki documents the legacy protocol. For the W3C protocol, stick to the actual spec.