python - selenium webdriver BrokenPipeError(超时问题)

标签 python python-3.x selenium-webdriver

我已将我的代码归结为以下内容:

from selenium import webdriver
from time import sleep
b = webdriver.Firefox()
sleep(10)
b.get('http://www.google.com')

这会导致 b.get 调用出现 BrokenPipeError。这是我的环境错误吗?我做错了什么,还是一个错误?

环境:

  • 软呢帽 27(64 位)
  • Firefox Quantum 59.0.2(64 位)
  • python 3.6.5
  • selenium 3.13.0(通过 pip)
  • 来自 github 的 geckodriver v0.21.0

更新: 我升级了我的工作站,并将其转移到 Fedora 28,并安装了全新的 Firefox 61、Python 3.6.5、Selenium 3.13.0 和 geckodriver 0.21.0,我在提供的脚本中遇到了同样的问题。

最佳答案

需要指定webdriver.exe文件的路径 首先指定 path ='你的 webdriver.exe 的路径'

path ='path of your webdriver.exe'
and then b = webdriver.Firefox(path)

关于python - selenium webdriver BrokenPipeError(超时问题),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51093204/

相关文章:

python - 为什么 selenium 在执行这段代码之前要等待很长时间?

c# - Selenium C# Firefox 22 - 来自网络的 "silent save file"不再工作

python - 从类和此类的实例访问函数

c# - 在 Selenium 中启用扩展启动 firefox

python - Pycharm 相对于虚拟环境的外部工具

python - 通过分隔符拆分 Pandas 数据框中的多列

python - 列表理解在 Python2 : how making it be compatible with Python3 中泄漏了它们的循环变量

python - 运行 python 代码给出 NameError : name 'ABCMeta' is not defined every time

python - 学习Python : Store values in dict from stdout

python - 如何打印出给定列表中的特定对象?