【Selenium + Python】之OSError: [WinError 6] 句柄无效。,oserrorwinerror,问题描述:执行多个用
【Selenium + Python】之OSError: [WinError 6] 句柄无效。,oserrorwinerror,问题描述:执行多个用
问题描述:执行多个用例的时候,会抛出异常:
Traceback (most recent call last): File "F:\Demo\pomGisStu\gis\test_case\models\mytest.py", line 9, in setUp self.driver = browser() File "F:\Demo\pomGisStu\gis\test_case\models\driver.py", line 4, in browser return webdriver.Chrome() File "F:\软件\python3.6.1\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 61, in __init__ self.service.start() File "F:\软件\python3.6.1\lib\site-packages\selenium\webdriver\chrome\service.py", line 66, in start self.service_args, env=env, stdout=PIPE, stderr=PIPE) File "F:\软件\python3.6.1\lib\subprocess.py", line 594, in __init__ _cleanup() File "F:\软件\python3.6.1\lib\subprocess.py", line 205, in _cleanup res = inst._internal_poll(_deadstate=sys.maxsize) File "F:\软件\python3.6.1\lib\subprocess.py", line 1025, in _internal_poll if _WaitForSingleObject(self._handle, 0) == _WAIT_OBJECT_0:OSError: [WinError 6] 句柄无效。
问题分析:
经查询得知,是因为后台有多个chromedriver.exe被启动,应该关闭它,自测得知最多只能打开三个测试用例的的浏览器
解决办法:
利用quit()方法关闭浏览器,不能使用close()方法关闭。
【Selenium + Python】之OSError: [WinError 6] 句柄无效。
相关内容
- Python3.x:简单时间调度Timer(间隔时间执行),python3
- python-gevent模块实现socket大并发,,服务器端:geven
- python单元测试unitest,,import uni
- python3的Cryptodome,,简介python3的
- PAT 1084 外观数列python解法,patpython,外观数列是指具有以
- ReferenceError: weakly-referenced object no longer exists Python k
- python---网络爬虫,,写了一个简单的网络爬
- 升级python2.6.6到python2.7导致pip命令不可用,,服务器环境
- python中的logger模块详细讲解,pythonlogger模块,logger 提供
- Python(pycharm)在windows下路径 ( ‘ / ‘ 与‘ \ ‘ )的问题
评论关闭