"Selenium + Python" OSError: [Winerror 6] handle is invalid.

Source: Internet
Author: User



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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.