elixir-wallaby / wallaby

Concurrent browser tests for your Elixir web apps.
https://twitter.com/elixir_wallaby
MIT License
1.68k stars 198 forks source link

chromedriver 115.0.5790.102 not working #739

Closed dvic closed 1 year ago

dvic commented 1 year ago

Elixir and Erlang/OTP versions

Erlang/OTP 26 [erts-14.0.2] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1] [jit]

Elixir 1.15.4 (compiled with Erlang/OTP 26)

Operating system

Mac OS 13

Browser

Google Chrome 115.0.5790.102

Driver

115.0.5790.102

Correct Configuration

Current behavior

Using Google Chrome and chromedriver 115.0.5790.102 I get the following error:

{:error, "unknown error: cannot find Chrome binary\n (Driver info: chromedriver=115.0.5790.102 (90efd4b0ad6aa15eeafcdabd5817ae939f7ba059-refs/branch-heads/5790_90@{#9}),platform=Mac OS X 13.4.1 arm64)"}

Is anyone else encountering this problem? Maybe something has changed and we need to pass in the path to the Google Chrome location?

Expected behavior

I expect no error.

Test Code & HTML

Install the latest Google Chrome and chromedriver.

Wallaby.start_session

results in

{:error, "unknown error: cannot find Chrome binary\n (Driver info: chromedriver=115.0.5790.102 (90efd4b0ad6aa15eeafcdabd5817ae939f7ba059-refs/branch-heads/5790_90@{#9}),platform=Mac OS X 13.4.1 arm64)"}

Demonstration Project

No response

dvic commented 1 year ago

Seems like an issue with chromedriver itself: https://bugs.chromium.org/p/chromedriver/issues/detail?id=4520&q=cannot%20find%20Chrome%20binary&can=2

dvic commented 1 year ago

@mhanberg adding the binary option to chromeOptions resolves the issue, is this something you want to add as a (temporary) fix for this problem? Maybe it's even something we want anyways so that the used chrome version in chromedriver is always the same as the one wallaby detects? image

mhanberg commented 1 year ago

That is reasonable.

You would just need to make sure that it's still override-able by the user.

dvic commented 1 year ago

@mhanberg I see the fix is in [1] by the way, I was not aware of the Chrome for Testing binaries [2], we should probably add those as well in the detection algorithm?

[1] https://developer.chrome.com/blog/chrome-for-testing/ [2] https://developer.chrome.com/blog/chrome-for-testing/

antonioparisi commented 1 year ago

I've updated to {:wallaby, "~> 0.30.5"} but I'm still experiencing this issue, anyone else? I'm on osx and even by specifying the binary to /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome in the chromeOptions I'm still getting:

unknown error: no chrome binary at /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome

(Driver info: chromedriver=115.0.5790.102 (90efd4b0ad6aa15eeafcdabd5817ae939f7ba059-refs/branch-heads/5790_90@{#9}),platform=Mac OS X 13.5.0 arm64)
dvic commented 1 year ago

How does your config for wallaby look like? Like this https://hexdocs.pm/wallaby/Wallaby.Chrome.html#module-chrome-binary?

antonioparisi commented 1 year ago

How does your config for wallaby look like? Like this https://hexdocs.pm/wallaby/Wallaby.Chrome.html#module-chrome-binary?

it does, yes.

config :wallaby, chromedriver: [
  path: System.get_env("CHROMEDRIVER_PATH"),
  binary: System.get_env("GOOGLE_CHROME_BIN")
]

GOOGLE_CHROME_BIN="/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome" CHROMEDRIVER_PATH=/opt/homebrew/bin/chromedriver

dvic commented 1 year ago

Can you double check the back ticks are properly parsed? (they should be omitted in the config right?) I’d just try without env var just to be sure

antonioparisi commented 1 year ago

Can you double check the back ticks are properly parsed? (they should be omitted in the config right?) I’d just try without env var just to be sure

I've just tried, still getting unknown error: cannot find Chrome binary very weird.

just for sanity check:

      case Wallaby.start_session(
        readiness_timeout: 30_000,
        capabilities: %{
          javascriptEnabled: true,
          chromeOptions: %{
            args: [
              "--no-sandbox", "window-size=1280,800", "--disable-gpu",
              "--fullscreen"
            ]
          }
        }
      ) do
...
config :wallaby, chromedriver: [
  path: System.get_env("CHROMEDRIVER_PATH"),
  binary: System.get_env("GOOGLE_CHROME_BIN")
]
CHROMEDRIVER_PATH=/opt/homebrew/bin/chromedriver
GOOGLE_CHROME_BIN=/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome
unknown error: cannot find Chrome binary
(Driver info: chromedriver=115.0.5790.102 (90efd4b0ad6aa15eeafcdabd5817ae939f7ba059-refs/branch-heads/5790_90@{#9}),platform=Mac OS X 13.5.0 arm64)
antonioparisi commented 1 year ago

nevermind, fixed it. since I'm running a custom session of Wallaby, I've set the binary option in the chromeOptions map