Pylance 无法识别 selenium 的 TimeoutException 类

问题描述 投票:0回答:1

我正在使用 VisualCode,当我尝试从 selenium 库导入 ConnectionRefusedError 时,出现错误。下面是我的代码片段

from selenium.common.exceptions import ConnectionRefusedError

错误

ConnectionRefusedError: [Errno 61] Connection refused

in addition to

urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=50166): Max retries exceeded with url: /session/2a50424f26d5dbcb77096e2ed2a0cfc6/url (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x15d878e60>: Failed to establish a new connection: [Errno 61] Connection refused'))

无法从 selenium 库导入 ConnectionRefusedError

我该如何解决这个问题? 我已经尝试过重新启动我的 ide、卸载 selenium、安装 selenium、清除缓存并卸载 pylance。

visual-studio-code selenium-webdriver selenium-chromedriver pylance
1个回答
0
投票

ConnectionRefusedError
不是 Selenium 的例外,它内置于 python 中。请参阅文档

© www.soinside.com 2019 - 2024. All rights reserved.