UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like
Gecko) Chrome/41.0.2272.101 Safari/537.36
Steps to reproduce the problem:
Send trivial execute script command.
[3.589][INFO]: COMMAND ExecuteScript {
"args": [ ],
"script": "return {length: 265};"
}
[3.590][INFO]: Waiting for pending navigations...
[3.590][INFO]: Done waiting for pending navigations
[3.597][INFO]: Waiting for pending navigations...
[3.597][INFO]: Done waiting for pending navigations
[3.597][INFO]: RESPONSE ExecuteScript [ null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null, null,
"..." ]
What is the expected behavior?
It should return an object {length: 265}
What went wrong?
It returns a list instead.
-- An example with a nested dictionary.
Note that baz's value is being incorrectly serialized as a list.
[2.757][INFO]: COMMAND ExecuteScript {
"args": [ ],
"script": "return {foo: \"bar\", baz: {length: 265}};"
}
[2.757][INFO]: Waiting for pending navigations...
[2.757][INFO]: Done waiting for pending navigations
[2.760][INFO]: Waiting for pending navigations...
[2.760][INFO]: Done waiting for pending navigations
[2.760][INFO]: RESPONSE ExecuteScript {
"baz": [ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, "..." ],
"foo": "bar"
}
Also, please note the description in webdriver's published spec:
http://www.w3.org/TR/webdriver/#synchronous-javascript-execution
3. Let value be the result of the following algorithm:
1. If result is:
1. undefined or null, return null.
2. a number, boolean, or DOMString, return result.
3. a DOMElement, then return the corresponding WebElement for that DOMElement.
4. an array or NodeList, then return the result of recursively applying this algorithm to result.
5. an object, then return the dictionary created by recursively applying this algorithm to each property in result.
Converting the object into a list is an unexpected behavior.
Original issue reported on code.google.com by hel...@google.com on 2 Apr 2015 at 3:48
Original issue reported on code.google.com by
hel...@google.com
on 2 Apr 2015 at 3:48