Skip to content

[WinError 6] The handle is invalid #3725

@EndermanAPM

Description

@EndermanAPM

Meta -

Python:
3.6.1 (32 and 64) 3.5.2 (64) and 3.5.3 (32)
OS:
Windows 10 / 2012
Selenium Version:
2.53.6/2.53.4
Browser:
Firefox

Browser Version:
37.0.2 x32/46.0.1 x32

Expected Behavior -

A driver should start given the profile.

Actual Behavior -

At random, it will fail raising WinError 6 and all the following tries will too.

Steps to reproduce -

Although not showed here, i also tried it without the Thread and was also raising the same error.


def setup_firefox_driver(dPath):
    fp = webdriver.FirefoxProfile()
    fp.set_preference("browser.download.folderList", 2)
    fp.set_preference("browser.download.manager.showWhenStarting", False)
    fp.set_preference("browser.download.dir", dPath)
    # fp.set_preference("browser.helperApps.neverAsk.saveToDisk", "application/pdf") #"
    fp.set_preference("browser.helperApps.neverAsk.saveToDisk", "application/octet-stream")
    fp.set_preference("pdfjs.disabled", True)
    return fp


def run(dPath):
    driver = webdriver.Firefox(firefox_profile=setup_firefox_driver(dPath))
    driver.close()

for x in range(100):
    t = threading.Thread(target=run, args=(x,))
    t.start()
    t.join()

This is one of the traces:


Exception in thread Thread-3:
Traceback (most recent call last):
  File "C:\Users\xavi\AppData\Local\Programs\Python\Python35\lib\threading.py", line 914, in _bootstrap_inner
    self.run()
  File "C:\Users\xavi\AppData\Local\Programs\Python\Python35\lib\threading.py", line 862, in run
    self._target(*self._args, **self._kwargs)
  File "<input>", line 2, in run
  File "C:\Users\xavi\AppData\Local\Programs\Python\Python35\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 80, in __init__
    self.binary, timeout)
  File "C:\Users\xavi\AppData\Local\Programs\Python\Python35\lib\site-packages\selenium\webdriver\firefox\extension_connection.py", line 52, in __init__
    self.binary.launch_browser(self.profile, timeout=timeout)
  File "C:\Users\xavi\AppData\Local\Programs\Python\Python35\lib\site-packages\selenium\webdriver\firefox\firefox_binary.py", line 67, in launch_browser
    self._start_from_profile_path(self.profile.path)
  File "C:\Users\xavi\AppData\Local\Programs\Python\Python35\lib\site-packages\selenium\webdriver\firefox\firefox_binary.py", line 90, in _start_from_profile_path
    env=self._firefox_env)
  File "C:\Users\xavi\AppData\Local\Programs\Python\Python35\lib\subprocess.py", line 571, in __init__
    _cleanup()
  File "C:\Users\xavi\AppData\Local\Programs\Python\Python35\lib\subprocess.py", line 195, in _cleanup
    res = inst._internal_poll(_deadstate=sys.maxsize)
  File "C:\Users\xavi\AppData\Local\Programs\Python\Python35\lib\subprocess.py", line 990, in _internal_poll
    if _WaitForSingleObject(self._handle, 0) == _WAIT_OBJECT_0:
OSError: [WinError 6] The handle is invalid

I would love to switch to selenium 3 but the action_chains doesn't seem to work not be supported.

Regards.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions