我试图在我的Instagram页面上使用一些机器人,但我无法登录。
这是我的密码:
from instapy import InstaPy
session = InstaPy(username='' ,password='')
session.login()我得到了一个错误:
SessionNotCreatedException: 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我有最新版本的火狐。
谢谢!
发布于 2020-11-18 05:59:18
您的代码应该如下所示:
from instapy import InstaPy
session = InstaPy(username='', password='')
session.login()确保您将您正在使用的Instagram帐户的登录信息也放置在用户名和密码参数中。
发布于 2021-04-08 14:15:09
我的解决方案
from instapy import InstaPy
session = InstaPy(username="username", password="password", browser_executable_path=r"C:\Program Files\Mozilla Firefox\firefox.exe")
session.login()在会话实例中传递 browser_executable_path =r“C:定制位置”。
重新安装Firefox并不适用于我。
解释
selenium.common.exceptions.SessionNotCreatedException: 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这一消息意味着,GeckoDriver在尝试启动/生成新的浏览上下文(即火狐浏览器会话)时,无法找到火狐二进制文件(firefox.exe)。
为什么?可能有两个原因之一:
system.
正常情况下,任何硒项目都需要.
options = webdriver.firefox.options.Options()
options.binary_location = r"C:\Program Files\Mozilla Firefox\firefox.exe"
browser = webdriver.Firefox(options=options)...for是一个定制的位置,通过Options()实例传递firefox二进制文件的绝对路径,但是由于InstaPy处理初始化浏览器,所以必须通过类属性"browser_executable_path“传递。
TL;DR:添加InstaPy类的参数browser_executable_path允许我将r“C:定制火狐位置”作为火狐位置传递。
参考资料
https://stackoverflow.com/questions/64887239
复制相似问题