更新时间:2022-01-27 08:16:26
此错误消息...
MaxRetryError: HTTPConnectionPool(host='127.0.0.1', port=51379): Max retries exceeded with url: /session/2e64d2a1-3c7f-4221-96fe-9d0b1c102195/window (Caused by ProtocolError('Connection aborted.', error(111, 'Connection refused')))
...表示 get()
方法未能引发 MaxRetryError .
几件事:
请求永不重试(它为urllib3的HTTPConnectionPool
设置了retries=0
),因此如果没有 MaxRetryError 和 HTTPConnectionPool ,该错误将更为规范. >关键字.因此理想的 Traceback 应该是:
Requests never retries (it sets the retries=0
for urllib3's HTTPConnectionPool
), so the error would have been much more canonical without the MaxRetryError and HTTPConnectionPool keywords. So an ideal Traceback would have been:
ConnectionError(<class 'socket.error'>: [Errno 1111] Connection refused)
但是@ sigmavirus24再次在他的评论中提到 ...包装这些异常会产生出色的API,但会带来不良的调试体验...
But again @sigmavirus24 in his comment mentioned ...wrapping these exceptions make for a great API but a poor debugging experience...
根据 Selenium 3.14.1 的发行说明:
* Fix ability to set timeout for urllib3 (#6286)
合并是:修复urllib3无法设置超时!
一旦升级到 Selenium 3.14.1 ,您将可以设置超时并查看规范的 Tracebacks ,并且可以采取必要的措施.
Once you upgrade to Selenium 3.14.1 you will be able to set the timeout and see canonical Tracebacks and would be able to take required action.
几个相关的事件引用: