【问题标题】:I was trying to use selenium and I got this error:我试图使用硒,我得到了这个错误:
【发布时间】:2018-04-19 05:01:43
【问题描述】:

我尝试使用 selenium,但出现此错误:

从硒导入网络驱动程序 浏览器=webdriver.Firefox() 回溯(最近一次通话最后): 文件“C:\Users\academy\AppData\Local\Programs\Python\Python35\lib\site-packages\selenium\webdriver\common\service.py”,第 74 行,开始 标准输出=self.log_file,标准错误=self.log_file) init 中的文件“C:\Users\academy\AppData\Local\Programs\Python\Python35\lib\subprocess.py”,第 950 行 恢复信号,开始新会话) _execute_child 中的文件“C:\Users\academy\AppData\Local\Programs\Python\Python35\lib\subprocess.py”,第 1220 行 启动信息) FileNotFoundError: [WinError 2] 系统找不到指定的文件

在处理上述异常的过程中,又发生了一个异常:

Traceback(最近一次调用最后一次):文件“”,第 1 行,in browser=webdriver.Firefox() 文件 "C:\Users\academy\AppData\Local\Programs\Python\Python35\lib\site-packages\selenium\webdriver\firefox\webdriver.py", 第 144 行,在 init 中 self.service.start() 文件 "C:\Users\academy\AppData\Local\Programs\Python\Python35\lib\site-packages\selenium\webdriver\common\service.py", 第 81 行,开始 os.path.basename(self.path),self.start_error_message)selenium.common.exceptions.WebDriverException:消息:'geckodriver' 可执行文件需要在 PATH 中。

我需要做什么来纠正这个问题?请帮忙。

【问题讨论】:

    标签: python-3.5


    【解决方案1】:

    您需要在 Windows 路径(而不是 Python 的库路径)中有一个文件“geckodriver.exe”(即 Firefox 的驱动程序)。

    要检查您是否在 shell 提示符下运行 geckodriver:which geckodriverwhere geckodriver

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-08-15
      • 2022-10-08
      相关资源
      最近更新 更多