Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 946594 - dev-python/selenium Headless selenium (firefox > v115.16.1-r1) does not work
Summary: dev-python/selenium Headless selenium (firefox > v115.16.1-r1) does not work
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal
Assignee: Python Gentoo Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-12-17 19:04 UTC by Henrik Johansson
Modified: 2025-03-11 23:07 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Henrik Johansson 2024-12-17 19:04:08 UTC
From https://forums.gentoo.org/viewtopic.php?p=8845757#8845757

I have problems getting Selenium to work with Firefox in headless mode. It used to work but at some point the past few months it seems to have stopped working. The following script works if I comment out the headless line, otherwise I get the error message below.

#!/usr/bin/python
from selenium import webdriver
options = webdriver.FirefoxOptions()
options.add_argument("--headless")
driver = webdriver.Firefox(options=options)
driver.get("https://google.com")
driver.quit()	

$ ./test
hrnick@crow ~/misc $ ./test
Traceback (most recent call last):
  File "/home/hrnick/misc/./test", line 8, in <module>
    driver = webdriver.Firefox(options=options)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/selenium/webdriver/firefox/webdriver.py", line 71, in __init__
    super().__init__(command_executor=executor, options=options)
  File "/usr/lib/python3.12/site-packages/selenium/webdriver/remote/webdriver.py", line 238, in __init__
    self.start_session(capabilities)
  File "/usr/lib/python3.12/site-packages/selenium/webdriver/remote/webdriver.py", line 325, in start_session
    response = self.execute(Command.NEW_SESSION, caps)["value"]
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/selenium/webdriver/remote/webdriver.py", line 380, in execute
    self.error_handler.check_response(response)
  File "/usr/lib/python3.12/site-packages/selenium/webdriver/remote/errorhandler.py", line 229, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: Process unexpectedly closed with status signal	

I'm running...

Code:	
dev-python/selenium-4.26.1
dev-util/selenium-manager-4.26.0-r1
www-client/firefox-132.0.1-r1
net-misc/geckodriver-0.35.0-r1

Any ideas what could be wrong? Could the separation of www-client/firefox and net-misc/geckodriver have anything to do with this? Downgrading to firefox-115.16.1-r1 makes the script work but with the following error message:

The geckodriver version (0.33.0) detected in PATH at /usr/bin/geckodriver might not be compatible with the detected firefox version (115.16.1); currently, geckodriver 0.35.0 is recommended for firefox 115.*, so it is advised to delete the driver in PATH and retry

Any help would be appreciated, thanks!

Reproducible: Always

Steps to Reproduce:
1. Run the script above
Actual Results:  
This causes an exception

Expected Results:  
The script should run headless

Downgrading to firefox-115.16.1-r1 makes the script work as intended. Could the separation of firefox and geckodriver have caused this?
Comment 1 Ben 2025-03-11 23:07:28 UTC
I cannot reproduce the error using the snippet script in #1 (short of the issues seen in bug 913889 i.e. need to set SE_MANAGER_PATH) - perhaps bleeding edge is not compatible with selenium-manager?  The script runs and exits with nothing printed.

Package versions I currently have installed:
www-client/firefox-128.8.0 (which is the ESR)
dev-python/selenium-4.29.0
dev-util/selenium-manager-4.29.0

I don't have a geckodriver package installed.