geckodriver icon indicating copy to clipboard operation
geckodriver copied to clipboard

Unknown Command is not sending correct error

Open titusfortner opened this issue 4 years ago • 3 comments
trafficstars

As part of testing the new shadow root endpoints, I'm running on Firefox and I'm not getting the error I'm expecting.

If the command has not been defined, then I expect to get a 404 response with a "text/json" payload with error value of "unknown command"

Instead I'm getting a 405 response with a "text/plain" payload, body: "HTTP method not allowed"

There's nothing in the Marionette logs:

2021-11-21 23:11:48 INFO Selenium -> POST session/97e180da-b667-9f4c-ac37-e5e980e48002/element
2021-11-21 23:11:48 INFO Selenium    >>> http://127.0.0.1:4444/session/97e180da-b667-9f4c-ac37-e5e980e48002/element | {"using":"xpath","value":".//*[local-name()='div'][@id='shadow_host']"}
2021-11-21 23:11:48 DEBUG Selenium      > {"Accept"=>"application/json", "Content-Type"=>"application/json; charset=UTF-8", "User-Agent"=>"selenium/4.0.2 (ruby macosx)", "Content-Length"=>"71"}
1637557908720	webdriver::server	DEBUG	-> POST /session/97e180da-b667-9f4c-ac37-e5e980e48002/element {"using":"xpath","value":".//*[local-name()='div'][@id='shadow_host']"}
1637557908723	Marionette	DEBUG	0 -> [0,3,"WebDriver:FindElement",{"using":"xpath","value":".//*[local-name()='div'][@id='shadow_host']"}]
1637557908727	Marionette	TRACE	[24] MarionetteCommands actor created for window id 4294967298
1637557908732	Marionette	DEBUG	0 <- [1,3,null,{"value":{"element-6066-11e4-a52e-4f735466cecf":"7627655a-bf31-6249-8cfe-b8971cdde149"}}]
1637557908732	webdriver::server	DEBUG	<- 200 OK {"value":{"element-6066-11e4-a52e-4f735466cecf":"7627655a-bf31-6249-8cfe-b8971cdde149"}}
2021-11-21 23:11:48 INFO Selenium <- {"value":{"element-6066-11e4-a52e-4f735466cecf":"7627655a-bf31-6249-8cfe-b8971cdde149"}}
2021-11-21 23:11:48 INFO Selenium -> GET session/97e180da-b667-9f4c-ac37-e5e980e48002/element/7627655a-bf31-6249-8cfe-b8971cdde149/shadow
2021-11-21 23:11:48 INFO Selenium <- HTTP method not allowed

Selenium::WebDriver::Error::WebDriverError: unexpected response, code=405, content-type="text/plain"
HTTP method not allowed

Fwiw, Safari is returning what I expect to see:

2021-11-21 23:30:52 INFO Selenium <- {"value":{"error":"unknown command","message":"The command 'GET \/session\/215CED6A-189A-4642-978E-47C958DCE530\/element\/node-8C118294-BDD3-4A9C-B94E-DEC393302060\/shadow' was not found.","stacktrace":""}}

titusfortner avatar Nov 22 '21 05:11 titusfortner

Thanks @titusfortner! We will cover that scenario via https://bugzilla.mozilla.org/show_bug.cgi?id=1742357

whimboo avatar Nov 22 '21 10:11 whimboo

This still seems not to be fixed as of v33. Getting 405 response with a "text/plain" payload, body: "HTTP method not allowed" for Geckodriver when I use a mis-specified command path...

GCuser99 avatar Jun 18 '23 21:06 GCuser99

Right, and that's the reason why this issue is still open. Also there is no easy fix for that. You can find more details in the above referenced bug.

whimboo avatar Jun 20 '23 19:06 whimboo