问题描述
报错描述,执行测试用例就有很多警告:DeprecationWarning: HTTPResponse.getheader() is deprecated and will be removed in urllib3 v2.1.0. Instead use
问题解决过程
1、根据网上资料提示,执行移除urllib3:
pip uninstall urllib3
移除后发现执行测试用例会提示缺少依赖包urllib
2、重新安装urllib3:
pip install urllib3 -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com
安装时报错:
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
requests 2.28.2 requires urllib3<1.27,>=1.21.1, but you have urllib3 2.2.2 which is incompatible.
selenium 4.2.0 requires urllib3[secure,socks]~=1.26, but you have urllib3 2.2.2 which is incompatible.
分析问题与解决办法
此时发现是urllib3版本与现有环境不兼容,根据提示需要安全urllib3 v1.26版本
因此我直接在pycharm中使用工具安装指定版本的urllib3 v1.26,重新启动pycharm,问题解决了。
安装后