Skip to content

Heroku buildpack google chrome

Lakshya Kapoor edited this page Jul 10, 2020 · 16 revisions

heroku-buildpack-google-chrome users need to use either of these options to help webdrivers find the custom install path to Google Chrome on Heroku. This is required so the gem can download the appropriate version of chromedriver.

Note: heroku-buildpack-chromedriver should be uninstalled to avoid any conflicts with this gem.

Option 1: Set the WD_CHROME_PATH environment variable to whatever $GOOGLE_CHROME_SHIM points to.

$ echo $GOOGLE_CHROME_SHIM
=> /app/.apt/usr/bin/google-chrome-stable

$ RAILS_ENV=test bundle exec rake webdrivers:chromedriver:update WD_CHROME_PATH=/app/.apt/usr/bin/google-chrome-stable

Or if you use Heroku CI with app.json:

"environments": {
  "test": {
    "env": {
      "WD_CHROME_PATH": "/app/.apt/usr/bin/google-chrome-stable"
    }

See the full app.json here.

Option 2: Set Selenium::WebDriver::Chrome.path (in your code) to whatever $GOOGLE_CHROME_SHIM points to.

require 'webdrivers'

Selenium::WebDriver::Chrome.path = ENV['GOOGLE_CHROME_SHIM'] if ENV['GOOGLE_CHROME_SHIM'].present?
driver = Selenium::WebDriver.for :chrome

Source

https://github.com/titusfortner/webdrivers/issues/72

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