python - 无法在 selenium chromedriver 上添加超过 20 个扩展
问题描述
我正在使用这段代码:
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:\Users\vanzw\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\connectionpool.py", line 665, in urlopen
httplib_response = self._make_request(
File "C:\Users\vanzw\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\connectionpool.py", line 421, in _make_request
six.raise_from(e, None)
File "<string>", line 3, in raise_from
File "C:\Users\vanzw\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\connectionpool.py", line 416, in _make_request
httplib_response = conn.getresponse()
File "C:\Users\vanzw\AppData\Local\Programs\Python\Python38-32\lib\http\client.py", line 1322, in getresponse
response.begin()
File "C:\Users\vanzw\AppData\Local\Programs\Python\Python38-32\lib\http\client.py", line 303, in begin
version, status, reason = self._read_status()
File "C:\Users\vanzw\AppData\Local\Programs\Python\Python38-32\lib\http\client.py", line 264, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "C:\Users\vanzw\AppData\Local\Programs\Python\Python38-32\lib\socket.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
推荐阅读
- c++ - While 循环接受第一个和第二个 cin 的输入
- django - 如何编辑由modelformset_factory生成的FormSet生成的表单?
- apache-camel - Spring @Transactional 和 Camel Transacted 之间的关系
- java - 无法在 cmd 中为扫描仪类输入键入输入
- java - BitmapFactory.Options 中没有封装
- vue.js - Intellisense 不适用于带有 vue cli 3 项目的 vscode 中的绝对路径,jsconfig 给出错误
- sql - Oracle:根据其他表的连接结果在表中插入记录,避免重复记录
- sql - SQL 中的过度连接
- sql - DB2 / SQL:检索修改或插入的 ID 列表
- ios - iOS - 保存到日志文件并稍后提取