当前位置:网站首页>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.
边栏推荐
猜你喜欢
Redis - cluster data distribution algorithm & hash slot
Sentinel rules persist to Nacos
Linked list (linear structure)
Pbootcms collection and warehousing tutorial quick collection release
Sentinel 阿里开源流量防护组件
Decryption skills of encrypted compressed files
TensorRT的数据格式定义详解
In depth understanding of JUC concurrency (I) what is JUC
数据科学【九】:SVD(二)
Redis——Cluster数据分布算法&哈希槽
随机推荐
Learn about various joins in SQL and their differences
pytest(1) 用例收集规则
CUDA与Direct3D 一致性
Redis---1.数据结构特点与操作
Data science [viii]: SVD (I)
Cglib代理-代码增强测试
Distributed transactions: the final consistency scheme of reliable messages
Sudo right raising
Hydration failed because the initial UI does not match what was rendered on the server.问题原因之一
unittest.TextTestRunner不生成txt测试报告
深入了解JUC并发(一)什么是JUC
Redis——Cluster数据分布算法&哈希槽
注解和反射详解以及运用
FE - 微信小程序 - 蓝牙 BLE 开发调研与使用
数据科学【九】:SVD(二)
Idea announced a new default UI, which is too refreshing (including the application link)
利用传统方法(N-gram,HMM等)、神经网络方法(CNN,LSTM等)和预训练方法(Bert等)的中文分词任务实现
代码技巧——Controller参数注解@RequestParam
栈(线性结构)
MySQL的10大經典錯誤