webdrivers: Can't find Chrome Binary in WSL2 with version 4.4.2

After updating to v4.4.2 my tests are failing with:

Webdrivers::BrowserNotFound:  Failed to find Chrome binary.

I’ve tried to set the WD_CHROME_PATH to the chrome binary path of my WSL2 Ubuntu installation but it doesn’t work either:

 Webdrivers::VersionError: Failed to find Chrome version
 RuntimeError:
            Failed to make system call: ["/home/fabio/.webdrivers/chromedriver.exe", "--version"]

What’s the proper way to use chrome on WSL2?

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 3
  • Comments: 16 (9 by maintainers)

Commits related to this issue

Most upvoted comments

@kapoorlakshya I did some more testing and I think we should revert this change: https://github.com/titusfortner/webdrivers/pull/187/files

It doesn’t work on WSLv2 and I don’t think it was tested on it. WSL2 networking is different from WSL1 and you can’t connect from the WSL2 Linux on chromedriver running on Windows using 127.0.0.1:9515, see: https://github.com/microsoft/WSL/issues/4619

So with this changed now it detects that is running on WSL but Selenium can’t connect to the chromedriver, so this just doesn’t work on WSL2.

Maybe we can revert this and make it more explicity changing the wsl? method to wslv1? and adding to the README that on WSL2 you have to install chrome o Linux. I don’t know if anyone goes through all the trouble to configure this port forwarding just to run Chrome on Windows.

@kapoorlakshya I don’t have WSLv2 setup, but happy to help where I can - I’ll see if I can find some time to try get it setup somewhere so I can test things locally.

Was this working in v4.4.1? And please share the debug logs (instructions). I’ll try to setup WSL2 tomorrow and reproduce this.

@G-Rath Would it be possible for you to troubleshoot this as well?