undetected-chromedriver
undetected-chromedriver copied to clipboard
status code 127
i am using Replit to run this code. i get status code 127 everytime i use undetected-chromedriver, chrome opens but the code gets stopped and give me an status code 127. this is the error i got:
Traceback (most recent call last): File "main.py", line 30, in on_message driver = uc.Chrome(options=chrome_options) File "/home/runner/web-bot/venv/lib/python3.8/site-packages/undetected_chromedriver/init.py", line 401, in init super(Chrome, self).init( File "/home/runner/web-bot/venv/lib/python3.8/site-packages/selenium/webdriver/chrome/webdriver.py", line 70, in init super(WebDriver, self).init(DesiredCapabilities.CHROME['browserName'], "goog", File "/home/runner/web-bot/venv/lib/python3.8/site-packages/selenium/webdriver/chromium/webdriver.py", line 90, in init self.service.start() File "/home/runner/web-bot/venv/lib/python3.8/site-packages/selenium/webdriver/common/service.py", line 98, in start self.assert_process_still_running() File "/home/runner/web-bot/venv/lib/python3.8/site-packages/selenium/webdriver/common/service.py", line 110, in assert_process_still_running raise WebDriverException( selenium.common.exceptions.WebDriverException: Message: Service /home/runner/.local/share/undetected_chromedriver/83040278187b388c_chromedriver unexpectedly exited. Status code was: 127
It probably means your chromedriver has crashed. Without any code or context it could be anything. We might help only if you post some code to reproduce what’s happening with you.
I also got this exact same error while running on replit. Here's the code -
import undetected_chromedriver as uc
from selenium.webdriver.chrome.options import Options
options = Options()
options.add_argument('--no-sandbox')
options.add_argument('--disable-dev-shm-usage')
options.add_argument("--incognito")
driver = uc.Chrome(options=options)
driver.get("https://google.com/")
Any help would be appreciated! 😀
Im having the exact same error running pretty much the exact same things as aasharck. I would love to hear if anyone has found a solution to this.
Okay, I found it. Undetected chromedriver module downloads the latest chromedriver on default which is incompatible with replit's chromium browser (both chromium and chromedriver must be the same version) so changing path of driver in constructor to location of replit's chromedriver should solve the problem.
By running chormedriver --help on replit's shell you can get full path.
How can i change path of the driver to location of replit's chromedriver, cause idk where's the chrome driver in replit is
@PhilipNiedzwiadek @sebdelsol @heckedbyfurki @aasharck Have u guys found solution for this error.
How can i change path of the driver to location of replit's chromedriver, cause idk where's the chrome driver in replit is
By running chormedriver --help on replits shell you can get full path.
@PhilipNiedzwiadek @sebdelsol @heckedbyfurki @aasharck Have u guys found solution for this error.
Read my comment above
Okay thanks I'll try!
@heckedbyfurki Hello i get same error + my chromium is 108.0.5359.94
and my chrome driver is 108.0.5359.71 and i set this by
how can i download same version of them?
@heckedbyfurki sir can u pls guide in steps how to solve this error. Really sir I'm not get single step of improvement.
@heckedbyfurki Hello i get same error + my chromium is 108.0.5359.94 and my chrome driver is 108.0.5359.71 and i set this by
how can i download same version of them?
It should be driver_executable_path, not browser_executable_path
@heckedbyfurki sir can u pls guide in steps how to solve this error. Really sir I'm not get single step of improvement.
-
Include chromedriver and chromium on nix packages
-
Initialize undetected chromedriver with driver_executable_path as replit's chromedriver path
-
Enjoy?
@heckedbyfurki im now getting permission denied
Normal selenium works man , uc doesnt
@heckedbyfurki sir can u pls guide in steps how to solve this error. Really sir I'm not get single step of improvement.
- Include chromedriver and chromium on nix packages
- Initialize undetected chromedriver with driver_executable_path as replit's chromedriver path
- Enjoy?
import undetected_chromedriver as uc
from selenium.webdriver.chrome.options import Options
options = Options()
options.add_argument('--no-sandbox')
options.add_argument('--disable-dev-shm-usage')
options.add_extension('Metamask.crx')
options.page_load_strategy = 'eager'
driver = uc.Chrome(options=options)
#driver.get("chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/home.html#onboarding/import-with-recovery-phrase")
driver.get("https://opensea.io")
print('finish')
Here my code.
I did all the things u guide to do but because of my skills I'm still getting same error.
Normal selenium works man , uc doesnt
Your error got fixed?
Still stuck on same error
@heckedbyfurki sir can u pls guide in steps how to solve this error. Really sir I'm not get single step of improvement.
- Include chromedriver and chromium on nix packages
- Initialize undetected chromedriver with driver_executable_path as replit's chromedriver path
- Enjoy?
hey bro sorry for pinging again, its giving permission error,Can you create a repl and give link to here that has working undetected chromedriver ?
if you got permission error when setting the driver_executable_path to /nix/store/.../chromedriver then try to give it permissions : chmod 777 /nix/store/.../bin/chromedriver
anybody found the fix i have tried everything but it just doesnt work
I have solved this - see https://stackoverflow.com/questions/71201650/
For the people who don't want to read through all of the comments to fix this, here's a step by step guide that confirmed works:
- Open up the replit shell and put in chromedriver --help. If you get prompted about the command not being installed, say yes. After it's done running, it should return something like this:
/nix/store/n4qcnqy0isnvxcpcgv6i2z9ql9wsxksw-chromedriver-114.0.5735.90
Usage: /nix/store/n4qcnqy0isnvxcpcgv6i2z9ql9wsxksw-chromedriver-114.0.5735.90/bin/chromedriver [OPTIONS]
Options
[insert a list of commands here]
Copy the directory labeled as "Usage" using ctrl+shift+c or via the right click menu (Replit copy/paste can be weird sometimes)
-
Any file in the nix directory needs permission in order to be accessed via a program. So, before you leave the shell, run
chmod 777 path/to/chromedriver
-
Going back to your code, you need to add an argument when you initialize uc. Copy/paste the following into your code:
import undetected_chromedriver as uc
driver = uc.Chrome(headless=True,use_subprocess=False, driver_executable_path = "path/to/chromedriver")
And there you have it! Now Undetected Chromedriver will run and probably not be able to pass through any bots because the IP address of Replit Virtual Hardware is suspicious as heck. Good luck!