Unable to find chrome binary in WSL while running Rails tests

Viewed 1937

I am trying to run integration tests for my Rails application in Windows Subsystem for Linux. I have downloaded the chromedriver file for windows from the official site and placed it in Documents/bin folder. I have added the following file in the same folder and saved it as chromedriver:

#!/bin/sh
chromedriver.exe "$@"

So presently Documents/bin folder has these two files: chromedriver.exe and chromedriver. I have added this folder to PATH in windows. When I type chromedriver -v in Ubuntu terminal in Windows I get the following output:

ChromeDriver 75.0.3770.90 (a6dcaf7e3ec6f70a194cc25e8149475c6590e025-refs/branch-heads/3770@{#1003})

But when I execute any Rails integration test I am getting the following error:

sh: 1: ["/usr/local/sbin", "/usr/local/bin", "/usr/sbin", "/usr/bin", "/sbin", "/bin", "/opt/google/chrome"]: not found 
sh: 1: ["/usr/local/sbin", "/usr/local/bin", "/usr/sbin", "/usr/bin", "/sbin", "/bin", "/opt/google/chrome"]: not found 
sh: 1: ["/usr/local/sbin", "/usr/local/bin", "/usr/sbin", "/usr/bin", "/sbin", "/bin", "/opt/google/chrome"]: not found 

Webdrivers::VersionError: Failed to find Chrome binary or its version.

chrome version in windows: Version 75.0.3770.90 (Official Build) (64-bit)

So linux is able to find chromedriver but not rails. How can I rectify this error? Should I run sudo apt-get install chromium chrome-driver? Or is there another method to make rails know the path to chromedriver binary?

1 Answers

You need to add the path to your chrome.exe to the PATH environment variable in Ubuntu

Related