Open michallepicki opened 9 months ago
Thank you, Michał, for posting this. We hit the same issue, and your workaround worked nicely for us! Very much appreciated!
Worked for us too! Thanks a bunch ❤️
@michallepicki How did you conclude that?
I tried your suggestion but it didn't work.
Before I see this invalid session ID
error, i see the following response for a POST /session
call to the driver server.
%{
"sessionId" => "e9796a5997cef178db3120e89d0f1f28",
"status" => 33,
"value" => %{
"message" => "session not created: Chrome failed to start: exited normally.\n (session not created: DevToolsActivePort file doesn't exist)\n (The process started from chrome location /usr/lib/chromium/chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)\n (Driver info: chromedriver=121.0.6167.184 (057a8ae7deb3374d0f1b04b36304d236f0136188-refs/branch-heads/6167@{#1818}),platform=Linux 5.15.49-linuxkit-pr aarch64)"
}
}
Any idea?
How did you conclude that?
I inspected responses from chromedriver somewhere in hound code, and there was an error about incorrect browser name. Unfortunately I am not familiar with the problem you're facing
I finally solved it by overriding the chromeOptions
that are set by default_capabilities
for chrome_headless
browser(I don't set user_agent
in additional capabilities). I had to also set the browserName
as an additional capability.
My config
config :hound,
driver: "chrome_driver",
browser: "chrome_headless",
host: System.get_env("HEADLESS_BROWSER_URL"),
port: 9515
I started my hound_session/1
in test like
defmodule SomeTest do
use ExUnit.Case
use Hound.Helpers
hound_session(additional_capabilities())
# some tests
defp additional_capabilities do
[
additional_capabilities: %{
:"goog:chromeOptions" => %{
"args" => [
"--headless",
"--disable-gpu",
"--no-sandbox",
"--disable-dev-shm-usage",
"--disable-software-rasterizer"
]
},
browserName: "chrome"
}
]
end
end
I am using a flavour of this docker image for starting a chrome driver server.
@HarshBalyan this shockingly worked for me as well. Thanks for the fix!
To fix the “invalid session id” we need to call: