How To Resolve OSError : WinError 6 The Handle is Invalid

Selenium

Share and Enjoy !

This is a very interesting failure. When we do prototype, say with 10 testcases,
Webdriver seems to have behave correctly. All testcases passes. Now when we
put out test suite,after execution of 10-12 testcases,It starts failing/Skipping or
erroring out. The trace we get is listed below:


Traceback (most recent call last):
File"C:UsersavraciuworkspaceAutomationTesting_v2.0srcHomeIPSEC
CreateIPSECCreate_IPSEC_GW_Term_Monthly.py", line 21, in
setUpself.driver = webdriver.Firefox()
File "C:Python34libsite-packagesseleniumwebdriverfirefoxwebdriver.py",
line 64,in __init__self.binary, timeout),
File "C:Python34libsite-packagesseleniumwebdriverfirefox
extension_connection.py",
 line 51, in __init__self.binary.launch_browser(self.profile)
File "C:Python34libsite-packagesseleniumwebdriverfirefox
firefox_binary.py", line 69,
 in launch_browser
self._start_from_profile_path(self.profile.path)
File "C:Python34libsite-packagesseleniumwebdriverfirefoxfirefox_binary.py",
line 92,
 in _start_from_profile_path  env=self._firefox_env)
File "C:Python34libsubprocess.py", line 754, in __init___cleanup()
File "C:Python34libsubprocess.py", line 474, in _cleanup
res = inst._internal_poll(_deadstate=sys.maxsize)
File "C:Python34libsubprocess.py", line 1146, in _internal_poll
if _WaitForSingleObject(self._handle, 0) == _WAIT_OBJECT_0:
OSError: [WinError 6] The handle is invalid

The Workaround:

Ads code goes here
Checkout the configuration may be that is wrong.Mostly the latest browser version and WebDriver version do not match. Downgrade one level down for browser. It should work. On the next step downgrade the Webdriver version as well.
Next is to check the version of the OS as well as the version of the installed software’s. Like-the eclipse,phython,webDriver etc. They should be as per OS. I mean if your’s is a 64 bit OS. Please use same 64 bit application as well. 

Share and Enjoy !

READ  Commonly Used Clipboard Objects in Testing

Leave a Comment

Your email address will not be published. Required fields are marked *