Open lawrencechen98 opened 1 year ago
This error message indicates that there is an issue with the Chromium webdriver that is being used by the undetected_chromedriver library. The specific error, "status error: -9", suggests that the webdriver process has exited with a non-zero exit code, which typically indicates that there was an error during execution.
One potential cause of this error is that the Chromium webdriver is not compatible with the platform you are using. In the code you provided, you are using the "mac_arm64" version of the webdriver, which is designed for macOS on ARM architecture. If you are not using macOS on ARM, this could be the reason why the webdriver is exiting with an error.
To fix this issue, you will need to use a different version of the Chromium webdriver that is compatible with your platform. You can check the supported platforms and architectures on the Chromium webdriver website to determine which version you should use.
Additionally, you should make sure that you are using the latest version of the undetected_chromedriver library, as it may include fixes for compatibility issues with the Chromium webdriver. You can check for updates on the library's GitHub page and install the latest version using pip or another package manager.
To confirm, I'm using a MacOS with Apple Silicon (M1) so it should be compatible with ARM. (In fact, the x64 version simply didn't execute at all, which is why I switched it.) I can also confirm that I'm using the latest undetected_chromedriver library (__version__ = "3.1.7"
). Unfortunately, with these settings, I'm still running into issues
You can try using a different version of ChromeDriver. The undetected_chromedriver package uses a specific version of ChromeDriver by default, but you can specify a different version by passing the executable_path argument to the Chrome() constructor, as shown below:
Copy code from selenium import webdriver
driver = webdriver.Chrome(executable_path="path/to/chromedriver") You can download different versions of ChromeDriver from the following URL: https://chromedriver.chromium.org/downloads
and can you send me the code of the executing part?
I believe something about the Patcher logic is leaving the executable corrupted. I downloaded a copy of the ChromDriver manually (version 108.0.5359.71) and was able to run it fine with selenium.webdriver. (I also tried with the other 108 version, which had the same issue).
>>> from selenium import webdriver
>>> webdriver.Chrome('/Users/lawrencechen/Downloads/chromedriver')
<selenium.webdriver.chrome.webdriver.WebDriver (session="704cd95a81df268bcb1a064673c6cb6c")>
However, if calling it with undetected_chromedriver, I get this:
>>> import undetected_chromedriver as uc
>>> driver = uc.Chrome(driver_executable_path='/Users/lawrencechen/Downloads/chromedriver')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/lawrencechen/.virtualenvs/proj/lib/python3.10/site-packages/undetected_chromedriver/__init__.py", line 429, in __init__
super(Chrome, self).__init__(
File "/Users/lawrencechen/.virtualenvs/proj/lib/python3.10/site-packages/selenium/webdriver/chrome/webdriver.py", line 81, in __init__
super().__init__(
File "/Users/lawrencechen/.virtualenvs/proj/lib/python3.10/site-packages/selenium/webdriver/chromium/webdriver.py", line 103, in __init__
self.service.start()
File "/Users/lawrencechen/.virtualenvs/proj/lib/python3.10/site-packages/selenium/webdriver/common/service.py", line 106, in start
self.assert_process_still_running()
File "/Users/lawrencechen/.virtualenvs/proj/lib/python3.10/site-packages/selenium/webdriver/common/service.py", line 119, in assert_process_still_running
raise WebDriverException(f"Service {self.path} unexpectedly exited. Status code was: {return_code}")
selenium.common.exceptions.WebDriverException: Message: Service /Users/lawrencechen/Downloads/chromedriver unexpectedly exited. Status code was: -9
And if I try to run the chromedriver again with selenium, it's no longer works:
>>> webdriver.Chrome('/Users/lawrencechen/Downloads/chromedriver')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/lawrencechen/.virtualenvs/proj/lib/python3.10/site-packages/selenium/webdriver/chrome/webdriver.py", line 81, in __init__
super().__init__(
File "/Users/lawrencechen/.virtualenvs/proj/lib/python3.10/site-packages/selenium/webdriver/chromium/webdriver.py", line 103, in __init__
self.service.start()
File "/Users/lawrencechen/.virtualenvs/proj/lib/python3.10/site-packages/selenium/webdriver/common/service.py", line 106, in start
self.assert_process_still_running()
File "/Users/lawrencechen/.virtualenvs/proj/lib/python3.10/site-packages/selenium/webdriver/common/service.py", line 119, in assert_process_still_running
raise WebDriverException(f"Service {self.path} unexpectedly exited. Status code was: {return_code}")
selenium.common.exceptions.WebDriverException: Message: Service /Users/lawrencechen/Downloads/chromedriver unexpectedly exited. Status code was: -9
This error is thrown by the WebDriverException class, which is a subclass of the SeleniumException class. This is a general exception that is thrown when there is an error in the WebDriver class, which is a part of the selenium package.
In this specific case, the error message indicates that the Chrome webdriver, which is being imported from the undetected_chromedriver module, unexpectedly exited with a status code of -9. This typically means that there was an issue with the webdriver itself, or with the way it was being called.
It is possible that the path to the chromedriver executable provided to the Chrome constructor is incorrect, or that the chromedriver executable itself is not functioning correctly. It is also possible that there is some other issue with the undetected_chromedriver module or with the selenium package that is causing this error to be thrown.
In order to troubleshoot this error, you will need to check the provided driver_executable_path to ensure that it points to the correct location of the chromedriver executable, and that the chromedriver executable itself is functioning correctly.
and for this: driver = uc.Chrome(driver_executable_path='/Users/lawrencechen/Downloads/chromedriver') you need to add the suffix of tthe file too
I use it like this for myself import undetected_chromedriver as uc driver = uc.Chrome(version_main=107) driver.get('link')
hi @lawrencechen98, did u solve it?
Didn't see but I got the same issue here https://github.com/ultrafunkamsterdam/undetected-chromedriver/issues/1020 and I only have it on one of two Mac M1 with the exact same hardware
experiencing the exact same issue, works fine on my intel mac but M1 no go
Just to close the loop on this per the PR above, you need to install rosetta and use the x64 chromedriver version for UC to work for M1 and M2 macs as of now.
Based on what I can tell, this means you can't take advantage of packages like webdriver-manager or the built in service in UC that downloads the correct driver for you because it grabs the arms64 version
Hi there! I'm running into a issue when trying to start the Chrome driver. For context, I'm running on the Mac M1 chip, which may be the cause of this issue. I'm running
undetected-chromedriver==3.1.7
Initially, I run into a bad CPU type issue:
I assumed it was because the default code for Darwin platform is set to
mac64
instead of being ARM compatible. So I changed the Patcher to the following:With this change, the
uc.Chrome()
call seems to make more progress, but then runs into the status error: -9 Here's how I replicated this issue:I see a Chrome browser launched, but then the exception happens immediately after. Same thing happens regardless if I use undetected_chromedriver.v2 or just undetected_chromedriver. I'm stuck on what might be causing this issue. Any help would be greatly appreciated, thanks!