Nazuk
Nazuk

Reputation: 21

Selenium::WebDriver::Error::UnknownError: unknown error: cannot find Chrome binary (Driver info: chromedriver=2.31.488774)

I'm trying to use Watir gem for writing scripts in ruby but the following code gives an error:

browser = Watir::Browser.new :chrome

Error:

Selenium::WebDriver::Error::UnknownError: unknown error: cannot find Chrome binary
  (Driver info: chromedriver=2.31.488774 (7e15618d1bf16df8bf0ecf2914ed1964a387ba0b),platform=Mac OS X 10.12.5 x86_64)

Please let me know the solution to the above issue.

Upvotes: 2

Views: 6064

Answers (4)

Sandip Subedi
Sandip Subedi

Reputation: 1077

Remember,

You also need to have chrome installed on the machine in order for Selenium Chrome Driver to work.

Upvotes: 2

suo
suo

Reputation: 398

The solution is to add the location of the Chrome or Chromium app to your PATH. You likely tried to organize the apps on your Mac and did not put Chrome directly in the Applications folder.

However it came to be, the folder containing the Chrome or Chromium .app is not in your PATH. To remedy it, edit your ~/.bash_profile and add a line such as:
export PATH="$PATH:/Applications/Web"
In this example, I have put all of my browsers in a folder called "Web" inside of Applications.

The more technical explanation is that chromedriver searches for a specific subpath within each entry in your PATH. The code that does it is here: Chromedriver Source Code

Upvotes: 0

Igbanam
Igbanam

Reputation: 6082

There may be some libraries which the the version of chromedriver you're trying to install depends on. You need to install these libraries to start chromedriver.

How did I solve this?

I SSH'd into my testing environment and ran chromedriver (I am using the latest version at the time of this answer: 2.35 on Ubuntu Trusty 14.04)

chromedriver: error while loading shared libraries: libnss3.so: cannot open ...

This is the Network Security Service library. Other versions may require some other libraries to be installed. Checkout this answer for more on this.

So I installed the library using apt-get.

p.s: Make sure you have Chrome installed in the box too. If you're using CircleCI, checkout this tip.

Upvotes: 1

R Balasubramanian
R Balasubramanian

Reputation: 809

This means that your script is unable to find the Chrome driver browser executable. Make sure that you have downloaded the Chrome browser from here. Additionally, from the ChromeDriver Capabilities docs,

Path to the Chrome executable to use (on Mac OS X, this should be the actual binary, not just the app. e.g., '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome')

Upvotes: 0

Related Questions