This runs locally (without specifying driver_path
), but not on Heroku.
Code:
Selenium::WebDriver::Chrome.driver_path = ENV[
I am quoting Ilya Vassilevsky from this post
ChromeDriver is just a driver for Chrome. It needs the actual Chrome browser installed on the same machine to actually work.
Heroku doesn't have Chrome installed on its dynos by default. You need to use a buildpack that installs Chrome. For example:
https://github.com/dwayhs/heroku-buildpack-chrome
You can see how it fetches Chrome:
https://github.com/dwayhs/heroku-buildpack-chrome/blob/master/bin/compile#L36-38
Then I read their discussion in the comments:
Petr Gazarov says
I tried this buildpack and it didn't work. I'm suspecting installing google chrome (or any browser) on heroku might be more involved.
Ilya Vassilevsky replies
Yes, Heroku is a very opinionated and closed platform. It should be much easier to set up Chrome with ChromeDriver on your own VM on AWS, Linode, or DigitalOcean.
Petr Gazarov replies
Thanks for your answer Ilya. I ended up re-writing with Watir with phantomjs because I couldn't get Heroku to install Chrome.
You can read more info in that question. If something comes to my mind, I will post it.