我正在使用以下代码:
chrome_options.add_extension(r'path to extension 1')
chrome_options.add_extension(r'path to extension 2')
...
chrome_options.add_extension(r'path to extension 20')
driver = webdriver.Chrome(executable_path = r"C:chromedriver.exe" , chrome_options=chrome_options)
出于某种原因,我想向 chrome 添加 100 个扩展程序,但是当我添加超过 20 个扩展程序时,我看到此错误:
driver = webdriver.Chrome(executable_path = r"C:chromedriver.exe" , chrome_options=chrome_options)
Traceback (most recent call last):
File "C:UsersvanzwAppDataLocalProgramsPythonPython38-32libsite-packagesurllib3connectionpool.py", line 665, in urlopen
httplib_response = self._make_request(
File "C:UsersvanzwAppDataLocalProgramsPythonPython38-32libsite-packagesurllib3connectionpool.py", line 421, in _make_request
six.raise_from(e, None)
File "<string>", line 3, in raise_from
File "C:UsersvanzwAppDataLocalProgramsPythonPython38-32libsite-packagesurllib3connectionpool.py", line 416, in _make_request
httplib_response = conn.getresponse()
File "C:UsersvanzwAppDataLocalProgramsPythonPython38-32libhttpclient.py", line 1322, in getresponse
response.begin()
File "C:UsersvanzwAppDataLocalProgramsPythonPython38-32libhttpclient.py", line 303, in begin
version, status, reason = self._read_status()
File "C:UsersvanzwAppDataLocalProgramsPythonPython38-32libhttpclient.py", line 264, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "C:UsersvanzwAppDataLocalProgramsPythonPython38-32libsocket.py", line 669, in readinto
return self._sock.recv_into(b)
ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine
我做错了什么?如何绕过 20 的限制,是什么原因导致此限制?
我一直无法完全解决这个问题,但我发现 20 扩展限制以某种方式与 Windows 20 套接字限制有关: https://forum.powerbasic.com/forum/user-to-user-discussions/programming-the-internet/771798-maximum-unique-tcp-connections-allowed-by-license-in-windows-10