Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Headless mode fails since Selenium 4.12.0 #205

Closed
robgjansen opened this issue Dec 11, 2023 · 1 comment
Closed

Headless mode fails since Selenium 4.12.0 #205

robgjansen opened this issue Dec 11, 2023 · 1 comment

Comments

@robgjansen
Copy link

robgjansen commented Dec 11, 2023

Minimal headless test script:

import tbselenium.common as cm
from tbselenium.tbdriver import TorBrowserDriver
from tbselenium.utils import launch_tbb_tor_with_stem

tbb_dir = "/home/test/tor-browser/"
tor_process = launch_tbb_tor_with_stem(tbb_path=tbb_dir)

with TorBrowserDriver(
        tbb_path=tbb_dir,
        executable_path="/home/test/geckodriver",
        tbb_logfile_path="/home/test/tbb.log",
        headless=True, 
        tor_cfg=cm.USE_STEM) as driver:
    driver.load_url("https://check.torproject.org")

tor_process.kill()

Running this with geckodriver-v0.31.0-linux64 and tor-browser-13.0.6.

The test script fails

$ python3 test.py
Traceback (most recent call last):                                                                                                                                  
  File "/home/test/test.py", line 8, in <module>                                                                                                             
    with TorBrowserDriver(                                                                                                                                          
  File "/home/test/tbenv/lib/python3.10/site-packages/tbselenium/tbdriver.py", line 103, in __init__                                                         
    super(TorBrowserDriver, self).__init__(                                                                                                                         
  File "/home/test/tbenv/lib/python3.10/site-packages/selenium/webdriver/firefox/webdriver.py", line 69, in __init__                                         
    super().__init__(command_executor=executor, options=options)                                                                                                    
  File "/home/test/tbenv/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 209, in __init__                                         
    self.start_session(capabilities)                                                                                                                                
  File "/home/test/tbenv/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 293, in start_session                                    
    response = self.execute(Command.NEW_SESSION, caps)["value"]                                                                                                     
  File "/home/test/tbenv/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 348, in execute                                          
    self.error_handler.check_response(response)                                                                                                                     
  File "/home/test/tbenv/lib/python3.10/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 1

Using selenium versions 4.16.0, 4.15.0, 4.14.0, and 4.13.0 all failed with the above error, but downgrading selenium to 4.12.0 finally worked for me:

pip remove selenium
pip install "selenium==4.12.0"
@gunesacar
Copy link
Collaborator

Thanks for filing this Rob. Will look into this ASAP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants