If you are using the chromedriver and Google Chrome Heroku buildpacks together, you may run into a driver compatibility issue with the version of chrome installed.
Example error:
Selenium::WebDriver::Error::SessionNotCreatedError (session not created: This version of ChromeDriver only supports Chrome version 83):
Use the webdrivers Ruby Gem instead of the chromedriver buildpack. It detects the version of Chrome you have installed, and then installs the appropriate version of chromedriver.
To use the gem, include it in your Gemfile:
gem 'webdrivers'
Once the gem is set, you need to tell it where Chrome is installed. If you are using the Chome buildpack, it adds environment variables you can use to get tha path to the installed Chrome binary.
Here is some sample Ruby code to initialize the driver:
options = Selenium::WebDriver::Chrome::Options.new
# Point the Chrome binary path to what's set in the envar
Selenium::WebDriver::Chrome.path = ENV['GOOGLE_CHROME_SHIM'] if ENV['GOOGLE_CHROME_SHIM'].present?
# Log the path for easy debugging
logger.info "Chrome binary path (if any): " + ENV.fetch('GOOGLE_CHROME_SHIM', "nil")
options.add_argument "--window-size=1280x1024"
options.add_argument "--headless"
options.add_argument "--disable-gpu"
driver = Selenium::WebDriver.for :chrome, options: options
Note the GOOGLE_CHROME_SHIM
envar is automatically set by your Chrome Heroku Buildpack, which you should make sure is running on your Heroku instance. Once you've switched to using the webdrivers gem, you can safely remove the heroku chromedriver buildpack from your app.
https://github.com/titusfortner/webdrivers/wiki/Heroku-buildpack-google-chrome
I have this same problem of compatibility between chrome and Chromedriver in my Java app. I'm using Heroku's Chrome and Chromedriver buildpacks and app crashes everytime there's a new update on Chrome's version