Heroku is a relatively closed and proprietary PaaS, yet my favourite one. In the past, I added a compiled PhantomJS executable in a
bin directory (read more).
Buildpacks for your heroku project
go to your heroku dashboard, select the project and add these buildpacks:
but running Watir still fails:
# runs on local machine just fine browser = Watir::Browser.new :chrome
heroku bash to the rescue
# in your terminal $ cd /your/project/path $ heroku run bash # on heroku bash # save the returned paths for future use $ which google-chrome $ which chromedriver
Setup Selenium (on production)
remember to wrap the Watir code in an if clause, so only your heroku project uses the new Selenium settings. I like to set a custom ENV variable on heroku for such things.
Selenium::WebDriver::Chrome.path = "path/to/google-chrome" Selenium::WebDriver::Chrome.driver_path = "path/to/chromedriver" browser = Watir::Browser.new :chrome