【问题标题】:selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable may have wrong permissions ON Herokuselenium.common.exceptions.WebDriverException:消息:“geckodriver”可执行文件可能在 Heroku 上有错误的权限
【发布时间】:2020-11-19 15:22:37
【问题描述】:

尝试使用InstaPY 为instagram 部署调查机器人,但在将https://github.com/evosystem-jp/heroku-buildpack-firefox buildpack 添加到Heroku 并将GECKODRIVER_PATH 设置为/app/vendor/geckodriver 并将FIREFOX_BIN 设置为/app/vendor/firefox 后会引发错误。

这是我的代码:

from instapy import InstaPy
from selenium import webdriver

import os
#Login 
session = InstaPy(username="USERNAME", password="PASSWORD",
                                geckodriver_path = os.environ.get("GECKODRIVER_PATH"), browser_executable_path=os.environ.get("FIREFOX_BIN"),
                                headless_browser = True)
    
session.login()

【问题讨论】:

  • 你可能应该使用 /app/vendor/geckodriver/ 而不是 /app/vendor/geckodriver/geckodriver
  • @Fominykh Maxim 现在它要求浏览器二进制位置。我应该如何添加它?
  • 而不是 geckodriver_path 尝试使用 browser_executable_path=/app/vendor/geckodriver/geckodriver
  • @Fominykh Maxim 这又带来了同样的问题。 Message: Expected browser binary location, but unable to find binary in default location, no 'moz:firefoxOptions.binary' capability provided, and no binary flag set on the command line 是上次与 /app/vendor/geckodriver 的确切错误。

标签: python selenium heroku geckodriver instapy


【解决方案1】:

在 InstaPy 类参数中,您应该显式添加 browser_executable_path。

尝试以下方法:

session = InstaPy(username="USERNAME",
                  password="PASSWORD",
                  browser_executable_path=os.environ.get("GECKODRIVER_PATH"),
                  headless_browser=True)

【讨论】:

    猜你喜欢
    • 2018-03-22
    • 1970-01-01
    • 2022-01-19
    • 1970-01-01
    • 1970-01-01
    • 2018-07-11
    • 1970-01-01
    • 2018-09-22
    • 2022-01-20
    相关资源
    最近更新 更多