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

因更换系统,重新安装了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")

报错:
ValueError: Timeout value connect was , 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

你可能感兴趣的:(python,selenium,开发语言)