当前位置:   article > 正文

python selenium报错ValueError: Timeout value connect was <...>, but it must be an int, float or None._raise valueerror( valueerror: timeout value connec

raise valueerror( valueerror: timeout value connect was

因更换系统,重新安装了selenium。命令:pip install selenium
默认版本为selenium4,版本不太兼容,所以卸载:pip uninstall selenium
更换为旧版本:pip install selenium==3.141.0
安装完以后显示:
Successfully installed selenium-3.141.0 urllib3-2.0.2(坑出现了)
运行一下代码以后报错:

from selenium import webdriver
driver = webdriver.Firefox()
driver.get("https://www.baidu.com")
  • 1
  • 2
  • 3

报错:
ValueError: Timeout value connect was <object object at 0x0000019A00694540>, but it must be an int, float or None.

其实是selenium版本和urllib3版本不兼容问题。更换urllib3版本:
pip uninstall urllib3
pip install urllib3==1.26.2
也可以更换selenium版本,参考以下文章:
https://blog.csdn.net/qq_48302722/article/details/130861992

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/121777
推荐阅读
相关标签