当前位置: 首页 > 知识库问答 >
问题:

browser=WebDriver.Firefox()出现问题

空翼
2023-03-14

我的代码(来自例如https://pypi.org/project/selenium/)

从selenium导入webdriver

浏览器=WebDriver.Firefox()

错误跟踪(最近一次调用):文件“C:\users\saltlake\appdata\local\programs\python\python38\lib\site-packages\selenium\webdriver\common\service.py”,第72行,在start self.process=subprocess.popen(cmd,env=self.env,文件“C:\users\saltlake\appdata\local\programs\python\python38\lib\subprocess.py”,第854行,在init self._execute_child(args,executable,preexec_fn,close_fds,文件“py”,第1307行,在_execute_child hp,ht,pid,tid=_winapi.createprocess(可执行文件,args,fileNotFounderRror:[WinError 2]系统找不到指定的文件

在处理上述异常时,又发生了一个异常:

回溯(最近一次调用):文件“d:\project\python-work\website.py”,第3行,在browser=webdriver.firefox()文件“c:\users\saltlake\appdata\local\programs\python\python38\lib\site-packages\selenium\webdriver\firefox\webdriver.py”,第164行,在init self.service.start()文件“c:\users\saltlake\appdata\local\programs\python\lib\site-packages\selenium\webdriver\common\service.py”,第81行,在start中引发WebDriverException(驱动程序的可执行文件需要在路径中。

有人知道这个问题/解决办法吗?

共有1个答案

葛威
2023-03-14

您之所以会出现此错误,是因为您没有Firefox的selenium web驱动程序。

要获得它,请访问网站https://github.com/mozilla/geckodriver/releases

下载适合您的操作系统的版本。

提取它

将解压缩文件放在运行此脚本的同一目录中。

即您的“website.py”文件必须与提取的文件位于同一目录中

维奥拉!!!

 类似资料:
  • 以下是错误: 对此有什么帮助吗?

  • 问题内容: 我在package.json中添加了proxy,效果很好,但是在npm run build之后,CORS问题再次浮出水面,有人知道在React中npm run build之后如何处理CORS问题。 我试图使用各种方法在axios请求中添加标头。但是,我未能在axios请求中添加’Access-Control-Allow- Origin’:’*’。我的代码如下: package.json

  • 问题内容: 该方法可以在127.0.0.1 上的Filezilla服务器上正常工作,但可以在诸如belnet.be之类的公共FTP服务器的根目录上返回。 下面的链接上有一个相同的问题,但似乎无济于事。 Apache CommonsFTPClient.listFiles 列表解析可能会带来问题吗?如果是这样,该如何解决呢? 编辑:这是目录缓存转储: FileZilla目录缓存转储 转储1个缓存目录

  • 本文向大家介绍VS2013的Browser Link引起的问题,包括了VS2013的Browser Link引起的问题的使用技巧和注意事项,需要的朋友参考一下 环境:vs2013 问题:在调用一个WebApi的时候出现了错误: 于是我用Fiddler 4直接调用这个WebApi,状态码是200(正常的),JSon里却提示在位置9409处文本非法, 以TextView方式查看,在9409处发现了Br

  • Object: Browser 包含浏览器各种属性的对象。 Browser.Features Browser.Features.xpath - (boolean) True如果浏览器支持XPath 。 Browser.Features.air - (boolean) True如果浏览器支持AIR 。 Browser.Features.query - (boolean) True如果浏览器支持que

  • Run Prettier in the browser with the standalone.js UMD bundle shipped in the NPM package (starting in version 1.13). The UMD bundle only formats the code and has no support for config files, ignore fi