Missing "id" in "Switch To Frame" command does not raise "invalid argument" error
Categories
(Testing :: geckodriver, defect, P3)
Tracking
(firefox124 fixed)
Tracking | Status | |
---|---|---|
firefox124 | --- | fixed |
People
(Reporter: whimboo, Assigned: jameshendry05, Mentored)
References
()
Details
(Whiteboard: [lang=rust][webdriver:m10][webdriver:external])
Attachments
(1 file, 1 obsolete file)
Originally filed as: https://github.com/mozilla/geckodriver/issues/2126
When observing the following lines it can be seen that a wrong payload where the element is not given under the id
field but at top-level causes an id
of null
to be added:
1691431487144 webdriver::server DEBUG -> POST /session/05ce34bc-23c6-426a-a61a-3c9edf3e72da/frame {"element-6066-11e4-a52e-4f735466cecf": "d128ee63-b2bc-4f2c-871a-bc3784aa6d9e"}
1691431487146 Marionette DEBUG 0 -> [0,9,"WebDriver:SwitchToFrame",{"id":null}]
With no id
specified geckodriver forwards just null
. Looking at the remote end steps for Switch To Frame
and specifically step 2 there is indeed a problem:
If id is not null, a Number object, or an Object that represents a web element, return error with error code invalid argument.
In the above case id
is not specified in the request and as such it should indeed fail with an invalid argument
error.
Reporter | ||
Updated•1 year ago
|
Assignee | ||
Comment 1•11 months ago
|
||
Going to have a crack at this soon, just documenting my findings so far.
Reproduction steps:
- Run
geckodriver -v
- Create a new session:
curl -v -X POST 127.0.0.1:4444/session -H "Content-Type: application/json" -d '{"capabilities": {"alwaysMatch": {"acceptInsecureCerts": true}}}'
- Navigate to a web page in the opened browser
- Using the session id from step 2:
curl localhost:4444/session/a6478af6-3792-4265-a501-733f7a47ef53/element/active
- Using the session id from step 2 and the element id from step 4:
curl -X POST localhost:4444/session/a6478af6-3792-4265-a501-733f7a47ef53/frame -H "Content-Type: application/json" -d '{"element-6066-11e4-a52e-4f735466cecf":"a1136754-9e25-4006-878b-f90316de01b2"}'
- Receive
{"value":null}
and observe the null id being forwarded to marionette instead of a 400 Invalid Argument error.
Assignee | ||
Comment 2•11 months ago
|
||
Updated•11 months ago
|
Assignee | ||
Comment 3•11 months ago
|
||
Fixed behaviour:
curl -X POST localhost:4444/session/$SESSION_ID/frame -H "Content-Type: application/json" -d '{}'
{"value":{"error":"invalid argument","message":"missing field `id` at line 1 column 2","stacktrace":""}}```
curl -X POST localhost:4444/session/$SESSION_ID/frame -H "Content-Type: application/json" -d '{"element-6066-11e4-a52e-4f735466cecf":"144f8120-dc30-46c4-aed6-8b7a9dd1aa3c"}'
{"value":{"error":"invalid argument","message":"missing field `id` at line 1 column 78","stacktrace":""}}
Passing {"id": null} explicitly still works:
curl -X POST localhost:4444/session/$SESSION_ID/frame -H "Content-Type: application/json" -d '{"id":null}'
{"value":null}
Updated•10 months ago
|
Assignee | ||
Comment 4•10 months ago
|
||
Updated•10 months ago
|
Reporter | ||
Comment 5•10 months ago
|
||
There was also a problem with null
as value for id
. As of now our implementation would trigger a switch to the parent frame, while it should indeed be the top-level frame. I'll adjust the bug's summary accordingly.
Reporter | ||
Comment 7•10 months ago
|
||
(In reply to Henrik Skupin [:whimboo][⌚️UTC+1] from comment #5)
There was also a problem with
null
as value forid
. As of now our implementation would trigger a switch to the parent frame, while it should indeed be the top-level frame. I'll adjust the bug's summary accordingly.
Actually this was just an internal naming issue in geckodriver and we already correctly passed the null
value to Marionette.
Comment 8•10 months ago
|
||
bugherder |
Reporter | ||
Comment 9•10 months ago
|
||
James, thank you a lot for your contribution! If you are interested on further contributions and you cannot find a specific bug to work on please let me know. I'm happy to help identifying a helpful bug. Some fix for dependencies for the 0.35.0 release (bug 1871543) would be great.
Description
•