Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chromedriver unexpectedly exited. Status code was: -9

I seem to have a setup issue with my Chrome driver for selenium. I really can't figure out the issue. Does anyone know what this is caused by / how to fix?

Sample Code

from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.common.by import By

driver = webdriver.Chrome(service=s)
s=Service(ChromeDriverManager().install())

Error Raised

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/selenium/webdriver/chrome/webdriver.py", line 70, in __init__
    super(WebDriver, self).__init__(DesiredCapabilities.CHROME['browserName'], "goog",
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/selenium/webdriver/chromium/webdriver.py", line 90, in __init__
    self.service.start()
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/selenium/webdriver/common/service.py", line 98, in start
    self.assert_process_still_running()
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/selenium/webdriver/common/service.py", line 110, in assert_process_still_running
    raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: Service /Users/antoinevandenheste/.wdm/drivers/chromedriver/mac64_m1/100.0.4896.60/chromedriver unexpectedly exited. Status code was: -9

What does Status code was: -9 mean? I think it must be something related to some weird Mac OS M1 stuff as always.

Note: that I have tried xattr -d com.apple.quarantine /Users/.../chromedriver but it doesn't solve the issue

like image 417
Anters Bear Avatar asked Nov 16 '25 04:11

Anters Bear


1 Answers

I am not sure if it will help everyone but it would have saved me tons of time.

I found that chromedriver didn't get killed and that kept raising the Status code was: -9.
When I did driver.quit() it killed the chromdriver process and was free to start another one. Or just kill it from your task manager/activity monitor/cli.

I have not figured out why it doesn't allow more processes of chromedriver at the same time. Maybe someone can comment on that.

like image 161
rain01 Avatar answered Nov 17 '25 18:11

rain01