【发布时间】:2019-06-08 10:20:37
【问题描述】:
问题
我一直在玩一个使用 Selenium 的 Python 脚本,它在本地运行良好(因为我在正确的目录中安装了 ChromeDriver,即assets/chromedriver),但它在 Heroku 上不起作用。我收到的错误消息摘要如下:
'chromedriver' executable needs to be in PATH.
No such file or directory: '/app/assets/chromedriver': '/app/assets/chromedriver'
ensure chromedriver is installed at /app/assets/chromedriver
采取的步骤
在部署到 Heroku 时,我在我的应用中安装了以下 Buildpack:
- https://github.com/heroku/heroku-buildpack-python
- https://github.com/heroku/heroku-buildpack-chromedriver
- https://github.com/heroku/heroku-buildpack-google-chrome
(注意:StackOverflow 上的很多答案都在谈论 heroku-xvfb-google-chrome buildpack,但我不想使用它,因为它依赖于 Cedar-14,它已在今年 4 月被弃用。)
我尝试将$GOOGLE_CHROME_BIN 和$GOOGLE_CHROME_SHIM 设置为指向app/assets/chromedriver 目录的配置变量,但这没有奏效。有谁知道如何在 Heroku 上的特定目录(在本例中为 app/assets/chromedriver)中安装 chromedriver?
我已经为此苦苦挣扎了好几天,如果能得到任何帮助,我将不胜感激!
【问题讨论】:
-
安装任何你想要的目录,然后在初始化你的ChromeDriver时指定目录
标签: python selenium heroku selenium-chromedriver