Skip to content

On macOS, Chrome 120+, UC Mode, and Headless Mode, the browser gets stuck after script ends #2375

Closed
@mdmintz

Description

@mdmintz

On macOS, Chrome 120+, UC Mode, and Headless Mode, the browser gets stuck after the script tries to quit the browser at the end.

(When ALL of those settings are combined, that leads to the issue where the driver/browser gets stuck during the quit() process.)

This is likely caused by a change in Chrome 120 / chromedriver 120, where os.waitpid() isn't getting the same result anymore when the browser process is terminated:

os.waitpid(self.browser_pid, 0)

The stack trace confirms it:

Traceback (most recent call last):
  File "/Users/michael/github/SeleniumBase/examples/raw_uc_mode.py", line 4, in <module>
    with SB(uc=True, test=True, headless=True) as sb:
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/contextlib.py", line 144, in __exit__
    next(self.gen)
  File "/Users/michael/github/SeleniumBase/seleniumbase/plugins/sb_manager.py", line 924, in SB
    sb.tearDown()
  File "/Users/michael/github/SeleniumBase/seleniumbase/fixtures/base_case.py", line 15997, in tearDown
    self.__quit_all_drivers()
  File "/Users/michael/github/SeleniumBase/seleniumbase/fixtures/base_case.py", line 14952, in __quit_all_drivers
    driver.quit()
  File "/Users/michael/github/SeleniumBase/seleniumbase/undetected/__init__.py", line 450, in quit
    os.waitpid(self.browser_pid, 0)
KeyboardInterrupt

Currently have to use CTRL+C to terminate the script from the console.

Metadata

Metadata

Assignees

Labels

UC Mode / CDP ModeUndetected Chromedriver Mode / CDP ModebugUh oh... Something needs to be fixed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions