0
votes

I am trying to scrap data in Heroku with the gem Watir but I have the following problem :

Selenium::WebDriver::Error::UnknownError (unknown error: cannot find Chrome binary

2018-06-12T17:29:54.221948+00:00 app[web.1]:   (Driver info: chromedriver=2.40.565383 

I am using those 2 buildpackers :

I don't understand how to fix the path in my rails project. As following this doc : https://github.com/heroku/heroku-buildpack-google-chrome#selenium

It's seems that I have to add this path

/app/.apt/usr/bin/google-chrome

But I don't understand at all where I have to add this.

If someone have the solution :) Thank you !

1
what is your browser version ? and on which OS ? - Prany
For the version you mean with 'browser.driver.capabilities[:version]' ? The result is 66.0. ... . And I am on ubuntu - Malus_khanot

1 Answers

0
votes

I finally find what's wrong !

The following answer by Anka is working for my case :

Ruby / Heroku Selenium::WebDriver::Error::WebDriverError: unable to connect to chromedriver 127.0.0.1:9516

Add the 2 following buildpacks :

https://github.com/heroku/heroku-buildpack-chromedriver

https://github.com/heroku/heroku-buildpack-google-chrome

Add the following information in the .env file :

GOOGLE_CHROME_SHIM = '/app/.apt/usr/bin/google-chrome'

Then call the Watir Browser as following :

opts = {
    headless: true
  }

  if (chrome_bin = ENV.fetch('GOOGLE_CHROME_SHIM', nil))
    opts.merge!( options: {binary: chrome_bin})
  end 

browser = Watir::Browser.new :chrome, opts