question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[🐛 Bug]: [WinError 6] The handle is invalid

See original GitHub issue

What happened?

    from selenium.webdriver.support import expected_conditions as EC
    from selenium.webdriver.common.by import By
    from selenium import webdriver
    from selenium.webdriver.firefox.options import Options
    from selenium.webdriver.common.keys import Keys
    from selenium.webdriver.common.by import By
    from selenium.common import exceptions
    from selenium.webdriver.common.action_chains import ActionChains
    from selenium.webdriver.support.ui import WebDriverWait
    from selenium.webdriver.firefox.webdriver import FirefoxProfile
    from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
    from selenium.webdriver.common.proxy import Proxy, ProxyType
    from selenium.webdriver.firefox.service import Service

    profile_path = "F:\\ea_env\\..................\\firefox_profile"
    cookie_path  = "F:\\ea_env\\..................\\firefox_cookie.pkl"
    my_url = "https://kitchen.applitools.com/ingredients/canvas/"
    
    profile_path = r"C:\Users\..................\Roaming\Mozilla\Firefox\Profiles\2jwvchja.bot5"
    desktop_path = str(pathlib.Path.home()) + '\\Desktop'
    gecko_path = f"{desktop_path}\\geckodriver.exe"
    options = Options()
    options.headless = False
    options.set_preference('profile', profile_path)
    service = Service(gecko_path)
    options.add_argument('--no-first-run --no-service-autorun --password-store=basic')
    options.add_argument('--excludeSwitches --enable-logging')
    options.add_argument('--no-default-browser-check')
    options.add_argument('--no-sandbox')
    driver = webdriver.Firefox (service=service, options=options)
    driver.implicitly_wait(100)
    driver.set_page_load_timeout(100)

    driver.get (my_url)
    canvas = driver.find_element(By.ID, "burger_canvas")
    action = ActionChains(driver)
    action.move_to_element_with_offset(canvas, 500, 350).click().perform()

How can we reproduce the issue?

I followed tutorial below and tried to do it by Python Standalone Selenium.
https://www.youtube.com/watch?v=NebFQ31NFtE
target url for test:
https://kitchen.applitools.com/ingredients/canvas

I saved canvas picture and tried to find the center location of canvas's button (Lets Eat) via Paint.
x: 500px
y: 350px

https://imgur.com/a/kya1dji

Relevant log output

Exception ignored in: <function Popen.__del__ at 0x0000013663B6E430>
Traceback (most recent call last):
  File "C:\Python38\lib\subprocess.py", line 949, in __del__        
    self._internal_poll(_deadstate=_maxsize)
  File "C:\Python38\lib\subprocess.py", line 1348, in _internal_poll
    if _WaitForSingleObject(self._handle, 0) == _WAIT_OBJECT_0:     
OSError: [WinError 6] The handle is invalid

Operating System

Windows 10 - 64 bit - latest build

Selenium version

Python 3.8.10 & 3.9.10 – Selenim 4.1.5

What are the browser(s) and version(s) where you see this issue?

Firefox 99

What are the browser driver(s) and version(s) where you see this issue?

Gecko driver 0.31

Are you using Selenium Grid?

No

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
titusfortnercommented, May 20, 2022

Your initial submission does not read like a bug report, but like you don’t know how to do something in Selenium. We close those issues because there are other places to get help.

If you think you have found a bug, you need to provide a reproducible use case, error message and a stack trace. You provided a bunch of information that won’t help us figure out the problem, and not enough information that would. What line of your code caused the error? A generic Python error could be a Selenium issue or something on your system, we need more info to help.

Now, no one likes feeling dismissed, but getting upset and tagging old contributors and adding emoji responses to your own comments is weird and unlikely to result in people wanting to help you. If you have something reproducible or even if you can tell us in which release something stopped working, that we can do something with.

1reaction
alimp5commented, May 19, 2022

@diemol I downgrade selenium to version 4.0.0 beta. and i didn’t receive any error message… 👍 when i’m talking about selenium bugs and a core developer is talking about tutorial t-shooting… Nothing Else…

Read more comments on GitHub >

github_iconTop Results From Across the Web

pyinstaller error: OSError: [WinError 6] The handle is invalid
This error apparently is thrown, because of this: Line 1117 in subprocess.py is: p2cread = _winapi.GetStdHandle(_winapi.STD_INPUT_HANDLE).
Read more >
FIX: OSError: [WinError 6] The handle is invalid · Issue #1066
If you every encounter this error in the future, you can try this tweak and see if it works for you. You basically...
Read more >
OSError: [WinError 6] The handle is invalid, what is it? - Reddit
Trying to run a project from github and I got this error.
Read more >
Reticulate & pyspark: [WinError 6] The handle is invalid
Running the following lines in RStudio, I get the following error: OSError: [WinError 6] The handle is invalid. import pyspark.pandas as ps ...
Read more >
Why I am receiving "OSError: [WinError 6] The handle is invalid"
Started as a program and it says OSError: [WinError 6] The handle is invalid Why? And what this error means? How to fix...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found