【发布时间】:2018-01-02 16:29:21
【问题描述】:
我正在使用 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
【问题讨论】:
-
您是否发现了问题所在以及如何解决?有同样的错误
-
不,很遗憾我没有:/
-
在使用带有 WebDrvier 的 Python 3 时遇到同样的问题,运行与 Python 2 对应的代码几乎相同的代码。我在一个盒子上运行了大约 10 个 Chromdriver 实例,但是这个问题仅在使用 Python 3.8 时出现,并且当实例数达到大约 8 个时似乎会发生,然后突然所有的 chrome 实例都被关闭并且新的实例不能被生成。仍在试图找出问题所在。
标签: python python-3.x selenium selenium-chromedriver