我添加了以下heroku-buildpack: google-chrome an heroku-buildpack-chromedriver,然后设置环境变量
GOOGLE_CHROME_BIN = /app/.apt/opt/google/chrome/chrome
GOOGLE_CHROME_SHIM = /app/.apt/usr/bin/google-chrome-stable我得到了下面的信息:
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我正在和它作斗争,不知道我做错了什么?如何知道我是否正确地设置了变量的路径?
发布于 2017-11-24 13:54:00
现在它可以正常工作了,doe是我所做的步骤,我将环境变量设置如下(你可以从heroku dashbord ->设置中进行设置)
GOOGLE_CHROME_BIN =/app/.apt/opt/google/chrome/google-chrome
GOOGLE_CHROME_SHIM= /app/.apt/opt/google/chrome/google-chrome然后在我想要运行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)
....多亏了https://github.com/heroku/heroku-buildpack-google-chrome/issues/26#issuecomment-346647415的帮助,我得到了帮助
https://stackoverflow.com/questions/47452107
复制相似问题