Closed Grant-Murray closed 11 years ago
Thanks for the bug report. I just tried to reproduce it on ChromeDriver v2.0 and selenium-server-standalone-2.33.0.jar on Arch Linux, and it worked for me. (I did run into another unrelated error with Firefox.)
Can you reproduce this on Sauce or can you try to do some debugging?
I ran it locally on firefox 23.0.1 and repeated the error. I ran it on Sauce and repeated the error: https://saucelabs.com/tests/bf7571dbfc6143418b30cddf5daaa23d I will try and work on debugging it next.
Ok, I think I have figured out something useful, when using this form:
webDriver.ExecuteScript("return document.readyState", nil)
it gets marshalled into { "args": null, "script": "return document.readyState" }
but when using this form:
var args []interface{} = []interface{}{}
result, err := webDriver.ExecuteScript("return document.readyState", args)
it gets marshalled into { "args": [], "script": "return document.readyState" } and it works.
I also noticed that the HTTP POST does not send the header which Java sends:
Content-Type: application/json; charset=utf-8
but this does not seem to make it crash, just not strictly correct
Thanks for digging into this.
The docs at https://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session/:sessionId/execute do indeed imply that the args
parameter must be an array.
Does https://github.com/sourcegraph/go-selenium/commit/0019dad88726d6eb3763853e26c01206704d404c fix it for you?
Yes, it does fix it. Thanks.
In my opinion, sending JSON { ..., "args": null} should be accepted since "null" is a valid JSON primitive and the docs say "Arguments may be any JSON-primitive,..."
BTW, I ran the tests and got a minor error:
--- FAIL: ExampleFindElement (3.3506941s)
got:
Page title: sourcegraph/go-selenium · GitHub
Repository: go-selenium
want:
Page title: sqs/go-selenium · GitHub
Repository: go-selenium
FAIL
exit status 1
FAIL github.com/sourcegraph/go-selenium 26.090s
you probably renamed sqs->sourcegraph at some point
Great, thanks!
yields: ERROR executing script: unknown error
the selenum server log shows 20:29:29.816 WARN - Exception thrown java.lang.NullPointerException at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:191) at com.google.common.collect.Iterables.transform(Iterables.java:708) at org.openqa.selenium.remote.server.handler.ExecuteScript.setJsonParameters(ExecuteScript.java:46) at org.openqa.selenium.remote.server.rest.ResultConfig.setJsonParameters(ResultConfig.java:309) at org.openqa.selenium.remote.server.rest.ResultConfig.handle(ResultConfig.java:193) at org.openqa.selenium.remote.server.JsonHttpRemoteConfig.handleRequest(JsonHttpRemoteConfig.java:192) at org.openqa.selenium.remote.server.DriverServlet.handleRequest(DriverServlet.java:201) at org.openqa.selenium.remote.server.DriverServlet.doPost(DriverServlet.java:167) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at org.openqa.selenium.remote.server.DriverServlet.service(DriverServlet.java:139) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
ChromeDriver (v2.3) selenium-server-standalone-2.35.0.jar Linux Desktop2012 3.10.9-1-ARCH #1 SMP PREEMPT Wed Aug 21 13:49:35 CEST 2013 x86_64 GNU/Linux