简体   繁体   English

Heroku未知错误:找不到Chrome二进制文件

[英]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.

相关问题 新手:WebDriverException:消息:未知错误:找不到 Chrome 二进制文件 - Newbie here: WebDriverException: Message: unknown error: cannot find Chrome binary WebDriverException:未知错误:对于旧版本的 Google Chrome,在 Python 中找不到带有 Selenium 的 Chrome 二进制错误 - WebDriverException: unknown error: cannot find Chrome binary error with Selenium in Python for older versions of Google Chrome Selenium 在 Mac 上给出“selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary” - Selenium gives "selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary" on Mac raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException:消息:未知错误:找不到 Chrome 二进制文件 - raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary Selenium 在环境中找不到 Chrome 二进制 Stacktrace - Selenium cannot find Chrome Binary Stacktrace in environment 运行代码时找不到 chrome 二进制文件 - cannot find chrome binary while running code selenium.common.exceptions.WebDriverException:消息:未知错误:无法使用 OperaDriver Selenium 和 Python 找到 Opera 二进制文件 - selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Opera binary with OperaDriver Selenium and Python Selenium.common.exceptions.WebDriverException:消息:未知错误:没有 chrome 二进制文件 - Selenium.common.exceptions.WebDriverException: Message: unknown error: no chrome binary WebDriverException:消息:未知错误:C:/.../Chrome/Application/chrome.exe 处没有 Chrome 二进制文件,带有 ChromeDriver Selenium 和 Python - WebDriverException: Message: unknown error: no chrome binary at C:/.../Chrome/Application/chrome.exe with ChromeDriver Selenium and Python 在詹金斯中执行python测试时找不到Chrome二进制文件 - cannot find Chrome binary when executing python test in jenkins
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM