gpt4 book ai didi

Python Selenium ConnectionResetError : [WinError 10054] An existing connection was forcibly closed by the remote host

转载 作者:太空狗 更新时间:2023-10-29 21:06:35 33 4
gpt4 key购买 nike

我正在使用 python 3.6 并使用最新版本的 chromedriver,我尝试使用旧版本的 chromedriver,我遇到了同样的问题,重新启动了我的电脑,同样的问题。这是我运行以重现错误的代码:

from selenium import webdriver

driver = webdriver.Chrome()

driver.get("https://google.com")

完整错误:

    driver.get("https://google.com")
File "C:\Python36\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 268, in get
self.execute(Command.GET, {'url': url})
File "C:\Python36\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 254, in execute
response = self.command_executor.execute(driver_command, params)
File "C:\Python36\lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 464, in execute
return self._request(command_info[0], url, body=data)
File "C:\Python36\lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 488, in _request
resp = self._conn.getresponse()
File "C:\Python36\lib\http\client.py", line 1331, in getresponse
response.begin()
File "C:\Python36\lib\http\client.py", line 297, in begin
version, status, reason = self._read_status()
File "C:\Python36\lib\http\client.py", line 258, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "C:\Python36\lib\socket.py", line 586, in readinto
return self._sock.recv_into(b)
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host

最佳答案

在 driver.get("https://google.com ") 之前放入 time.sleep(3),这将修复您的错误。那么如果你像我一样,你会得到一个不同的错误。

关于Python Selenium ConnectionResetError : [WinError 10054] An existing connection was forcibly closed by the remote host,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45342383/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com