当前位置:网站首页>Selenium memo: selenium\webdriver\remote\remote_ connection. Py:374: resourcewarning: unclosed < XXXX > solution
Selenium memo: selenium\webdriver\remote\remote_ connection. Py:374: resourcewarning: unclosed < XXXX > solution
2022-07-02 06:33:00 【bthtth】
Use selenium when ,remote_connection.py Module error resourcewarning terms of settlement
Error code and screenshot
from selenium import webdriver
driver = webdriver.Edge()
driver.get("https://sjz.58.com/")
driver.maximize_window()
The error information is as follows :
XXXXX ResourceWarning: unclosed <socket.socket xxxx>
return self._request(command_info[0], url, body=data)
terms of settlement
Most of the big ways online are ignore warning Method , This is easier to search , You can search by yourself .
Another way is to solve the problem fundamentally , I agree with . The original text is at the back , Thanks to bloggers .
Edge() There is an initialization parameter keep-live, Used to set long connection , The default value is False.
`class WebDriver(RemoteWebDriver):
def __init__(self, executable_path='MicrosoftWebDriver.exe',
capabilities=None, port=0, verbose=False, service_log_path=None,
log_path=None, keep_alive=False)
`
If default values are used , will resourcewarning. So in creating driver At instance time , take keep_alive=True Just bring it in
from selenium import webdriver
driver = webdriver.Edge(keep_alive=False)
driver.get("https://sjz.58.com/")
driver.maximize_window()
original text
link : link.
边栏推荐
猜你喜欢
AWD学习
Introduce two automatic code generators to help improve work efficiency
Sparse array (nonlinear structure)
ctf-web之练习赛
Don't use the new WP collection. Don't use WordPress collection without update
栈(线性结构)
The difference between session and cookies
Redis——Cluster数据分布算法&哈希槽
Detailed definition of tensorrt data format
In depth understanding of JUC concurrency (I) what is JUC
随机推荐
Sentinel rules persist to Nacos
栈(线性结构)
NodeJs - Express 中间件修改 Header: TypeError [ERR_INVALID_CHAR]: Invalid character in header content
程序员的自我修养—找工作反思篇
AWD学习
注解和反射详解以及运用
一口气说出 6 种实现延时消息的方案
pytest(3)parametrize参数化
Don't use the new WP collection. Don't use WordPress collection without update
Sentinel 阿里开源流量防护组件
介绍两款代码自动生成器,帮助提升工作效率
奇葩pip install
The difference between session and cookies
Cglib agent - Code enhancement test
Arduino Wire 库使用
CUDA中的Warp Shuffle
Redis---1.数据结构特点与操作
Redis——热点key问题
MySql索引
CUDA中的线程层次