[英]Heroku unknown error: cannot find Chrome binary
I added the following heroku-buildpack: google-chrome an heroku-buildpack-chromedriver Then I set the environment variables 我添加了以下heroku-buildpack:google-chrome a heroku-buildpack-chromedriver然后设置环境变量
GOOGLE_CHROME_BIN = /app/.apt/opt/google/chrome/chrome
GOOGLE_CHROME_SHIM = /app/.apt/usr/bin/google-chrome-stable
And I get the folowing message: 我得到以下信息:
Exception Type: WebDriverException
Exception Value:
Message: unknown error: cannot find Chrome binary
(Driver info: chromedriver=2.33.506092 (733a02544d189eeb751fe0d7ddca79a0ee28cce4),platform=Linux 3.13.0-133-generic x86_64)
Exception Location: /app/.heroku/python/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py in check_response, line 194
I am struggle with it and dont know what am I doing wrong? 我正在为此苦苦挣扎,不知道我在做什么错? And how do I know if I set the path of the variable correctly?
我怎么知道我是否正确设置了变量的路径?
Now its working greate, doe's are the steps I done I set the enviroment varible as folow (you can do it form the heroku dashbord -> setting) 现在可以正常工作了,doe是我完成的步骤,将环境变量设置为以下(您可以通过heroku dashbord->设置来完成)
GOOGLE_CHROME_BIN =/app/.apt/opt/google/chrome/google-chrome
GOOGLE_CHROME_SHIM= /app/.apt/opt/google/chrome/google-chrome
then in my djanogo project where I want to run selenuim 然后在我想运行selenuim的djanogo项目中
from selenium import webdriver
from selenium.webdriver.chrome.options import Options as ChromeOptions
chrome_bin = os.environ.get('GOOGLE_CHROME_SHIM', None)
opts = ChromeOptions()
opts.binary_location = chrome_bin
driver = webdriver.Chrome(executable_path="chromedriver",
chrome_options=opts)# webdriver.Chrome(DRIVER)
driver.get(url)
....
I got the help thanks to frbry from https://github.com/heroku/heroku-buildpack-google-chrome/issues/26#issuecomment-346647415 感谢来自https://github.com/heroku/heroku-buildpack-google-chrome/issues/26#issuecomment-346647415的 frbry,我得到了帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.