Unable to get response from `POST /session/:sessionId/se/log`

426 views
Skip to first unread message

Ankur Narkhede

unread,
Feb 26, 2022, 3:52:41 AM2/26/22
to Selenium Users

I am trying to get the logs from  POST /session/:sessionId/se/log API. Following are the steps I followed:

1. Start Selenium 4 session with the following command
java -Dwebdriver.chrome.driver="/Users/ankur/chromedriver" -jar selenium-server-4.1.1.jar standalone --driver-configuration display-name="Chrome" stereotype='{"browserName": "chrome", "browserVersion": "95", "goog:chromeOptions":{"binary":"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"}}'

2. Start a session with the following request:
curl --location --request POST 'localhost:4444/wd/hub/session' \\ --header 'Content-Type: application/json; charset=utf-8' \\ --data-raw '{ "desiredCapabilities": { "browserName": "chrome", "goog:chromeOptions": { "args": [ "--remote-debugging-port=9225" ] }, "goog:loggingPrefs": { "browser": "ALL", "driver": "ALL", "server": "ALL" } }, "capabilities": { "browserName": "chrome" } }'

3. Get logs with the following request:
 curl --location --request GET 'localhost:4444/session/30b9b9b2b29ff8bfeedfd5c27a418c23/se/log' \\ --header 'Content-Type: application/json; charset=utf-8' \\ --data-raw ''

Getting the error:

{ "value": { "error": "script timeout", "message": "Unable to execute request for an existing session: GET /session/30b9b9b2b29ff8bfeedfd5c27a418c23/se/log\\nBuild info: version: '4.1.1', revision: 'e8fcc2cecf'\\nSystem info: host: 'MacBook-Pro.local', ip: 'fe80:0:0:0:18df:a1f9:77fb:d522%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.16', java.version: '1.8.0_311'\\nDriver info: driver.version: unknown", "stacktrace": "java.lang.RuntimeException: Unable to execute request for an existing session: GET /session/30b9b9b2b29ff8bfeedfd5c27a418c23/se/log\\nBuild info: version: '4.1.1', revision: 'e8fcc2cecf'\\nSystem info: host: 'MacBook-Pro.local', ip: 'fe80:0:0:0:18df:a1f9:77fb:d522%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.16', java.version: '1.8.0_311'\\nDriver info: driver.version: unknown\\n\\tat org.openqa.selenium.grid.router.HandleSession.execute(HandleSession.java:139)\\n\\tat org.openqa.selenium.remote.http.Route$PredicatedRoute.handle(Route.java:373)\\n\\tat org.openqa.selenium.remote.http.Route.execute(Route.java:68)\\n\\tat org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:336)\\n\\tat org.openqa.selenium.remote.http.Route.execute(Route.java:68)\\n\\tat org.openqa.selenium.grid.router.Router.execute(Router.java:91)\\n\\tat org.openqa.selenium.grid.web.CheckOriginHeader.lambda$apply$0(CheckOriginHeader.java:66)\\n\\tat org.openqa.selenium.grid.web.CheckContentTypeHeader.lambda$apply$0(CheckContentTypeHeader.java:70)\\n\\tat org.openqa.selenium.grid.web.EnsureSpecCompliantResponseHeaders.lambda$apply$0(EnsureSpecCompliantResponseHeaders.java:34)\\n\\tat org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:64)\\n\\tat org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:336)\\n\\tat org.openqa.selenium.remote.http.Route.execute(Route.java:68)\\n\\tat org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:336)\\n\\tat org.openqa.selenium.remote.http.Route.execute(Route.java:68)\\n\\tat org.openqa.selenium.remote.AddWebDriverSpecHeaders.lambda$apply$0(AddWebDriverSpecHeaders.java:35)\\n\\tat org.openqa.selenium.remote.ErrorFilter.lambda$apply$0(ErrorFilter.java:44)\\n\\tat org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:64)\\n\\tat org.openqa.selenium.remote.ErrorFilter.lambda$apply$0(ErrorFilter.java:44)\\n\\tat org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:64)\\n\\tat org.openqa.selenium.netty.server.SeleniumHandler.lambda$channelRead0$0(SeleniumHandler.java:44)\\n\\tat java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)\\n\\tat java.util.concurrent.FutureTask.run(FutureTask.java:266)\\n\\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)\\n\\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)\\n\\tat java.lang.Thread.run(Thread.java:748)\\n" } }

How can I get the logs here?

⇜Krishnan Mahadevan⇝

unread,
Feb 28, 2022, 6:25:11 AM2/28/22
to Selenium Users
Ankur,

From what I am seeing there are a couple of discrepancies here ( Its been sometime since I looked at the grid codebase so what I am deciphering here may be a bit off track)

You would need to be using POST and NOT GET for the logs endpoint.

When you trigger a post that command seems to be getting forwarded to the actual webdriver binary ( For e.g., hub -> node -> chromedriver )

And the ChromeDriver binary does not seem to be supporting log type as "server"

You can cross check this by triggering your new session post against localhost:9515 (which is where the chromedriver by default listens to when started)

Now coming to the part of where you are trying to retrieve the session logs, do you know if this ever worked in 4.x series ?

I ask because I am seeing some discrepancies for which I am yet to get some answers.

For e.g., 

The codebase defines an endpoint which should map to "/logs" but it does not have any prefix.

So I tried triggering both localhost:4444/logs (hits the hub) and localhost:5555/logs and in both the cases I was basically hitting an error which said "Not a valid route" (Invalid URL).

I tried replacing "/logs" with "/getSessionLogs" because that seems to be translation mechanism, wherein the logic within the codebase finds the corresponding mapping for the pseudo name "getSessionLogs" and translates that to "logs"

But the node refuses to honour any URL that doesn't seem to be having "session".

Which brings me back to my first question. Do u know if this ever worked in 4.x series? If not, I think this is perhaps a bug.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribblings @ https://rationaleemotions.com/


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/601c09e5-f353-4dff-be84-e3dabb585816n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages