一个分裂错误:找不到驱动程序错误,为什么会这样说?

问题描述 投票:0回答:2

我对 splinter 完全陌生,对 python 也很陌生。我想做一个分裂程序,当我在计算机上运行该程序时,它会自动登录到网站。我在网上搜索了一下 splinter,并创建了一个程序来尝试打开网络浏览器并在其中搜索某些内容。但是,出现这个错误:

================= RESTART: C:/Users/hp/Desktop/splinterexp.py =================
Traceback (most recent call last):
  File "C:/Users/hp/Desktop/splinterexp.py", line 4, in <module>
    browser = Browser()
  File "C:\Users\hp\AppData\Local\Programs\Python\Python311\Lib\site-packages\splinter\browser.py", line 123, in Browser
    raise DriverNotFoundError(f'Driver for {driver_name} was not found.')
splinter.exceptions.DriverNotFoundError: Driver for firefox was not found.

这是我输入的代码:

from splinter import Browser


browser = Browser()

browser.visit('http://google.com')

提前致谢。

python splinter
2个回答
1
投票

根据 Splinter 文档

firefox
是默认浏览器。并且根据您提供的错误信息,您没有安装 Firefox Web 驱动程序。

因此,您要么要安装 geckodriver,要么指定已安装网络驱动程序的浏览器。


0
投票

文档对我来说不是很清楚(...)但试试这个:

python -m pip install selenium
© www.soinside.com 2019 - 2024. All rights reserved.