当前位置:网站首页>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.
边栏推荐
猜你喜欢

IPv6 experiment and summary

Singleton mode compilation

New version of dedecms collection and release plug-in tutorial tool

Log (common log framework)

pytest(2) mark功能

Sublime Text 配置php编译环境

Learn about various joins in SQL and their differences

Code skills - Controller Parameter annotation @requestparam

阿里云MFA绑定Chrome浏览器

分布式事务 :可靠消息最终一致性方案
随机推荐
重载全局和成员new/delete
CUDA中的Warp Shuffle
eslint配置代码自动格式化
CUDA中的函数执行空间说明符
深入了解JUC并发(一)什么是JUC
Flask-Migrate 检测不到db.string() 等长度变化
Sentinel 阿里开源流量防护组件
It is said that Kwai will pay for the Tiktok super fast version of the video? How can you miss this opportunity to collect wool?
TensorRT中的循环
【程序员的自我修养]—找工作反思篇二
20210306转载如何使TextEdit有背景图片
20201002 VS 2019 QT5.14 开发的程序打包
看完有用的blog
找到页面当前元素z-index最高的数值
链表(线性结构)
Distributed transactions: the final consistency scheme of reliable messages
CUDA用户对象
Pbootcms collection and warehousing tutorial quick collection release
TensorRT的功能
计算属性普通函数写法 和 set get 写法