2

I am trying to deploy selenium script using flask on heroku.

I added the following buildpacks

  1. https://github.com/heroku/heroku-buildpack-xvfb-google-chrome
  2. https://github.com/heroku/heroku-buildpack-chromedriver

And I also created config variables as:

  1. CHROMEDRIVER_PATH = "/my-app/.chromedriver/bin/chromedriver"
  2. GOOGLE_CHROME_SHIM = "/my-app/.apt/usr/bin/google-chrome"

And below is the Python snippet for referring to chromedriver:

chrome_bin = os.environ.get('GOOGLE_CHROME_SHIM', None)
opts = ChromeOptions()
opts.binary_location = chrome_bin
browser = webdriver.Chrome(executable_path="chromedriver", chrome_options=opts)  

But when i open my app following error occurred:

WebDriverException: Message: unknown error: no chrome binary at /tmp/build_4cef63dfa1c952837ceb30f2e894524a/.apt/usr/bin/google-chrome-stable`

PLEASE HELP!!!!

1
  • You should not use selenium on heroku, it is not meant for it. Get a online service like browserstack, saucelabs or something else and then use remote webdriver Commented Oct 25, 2017 at 8:03

1 Answer 1

1

GOOGLE_CHROME_SHIM is set wrongly in the config. Use the below config instead.

opts.binary_location = "/app/.apt/usr/bin/google-chrome-stable"

That worked for me.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.