Problem Description: When executing multiple use cases, an exception is thrown:
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:\Software\python3.6.1\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 61, in __init__
self.service.start()
File "F:\Software\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:\Software\python3.6.1\lib\subprocess.py", line 594, in __init__
_cleanup()
File "F:\Software\python3.6.1\lib\subprocess.py", line 205, in _cleanup
res = inst._internal_poll(_deadstate=sys.maxsize)
File "F:\Software\python3.6.1\lib\subprocess.py", line 1025, in _internal_poll
if _WaitForSingleObject(self._handle, 0) == _WAIT_OBJECT_0:
OSError: [WinError 6] The handle is invalid.
Problem Analysis:
After the query, because there are multiple chromedriver.exe in the background is started, it should be closed, self-test to know that up to Three testing cases can only open a browser
Workaround:
Use the Quit () method to close the browser and not close using the close () method.
"Selenium + Python" OSError: [Winerror 6] handle is invalid.