undetected-chromedriver icon indicating copy to clipboard operation
undetected-chromedriver copied to clipboard

status code 127

Open defning opened this issue 2 years ago • 23 comments

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

defning avatar Apr 02 '22 12:04 defning

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.

sebdelsol avatar Apr 06 '22 13:04 sebdelsol

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! 😀

aasharck avatar Nov 25 '22 09:11 aasharck

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.

PhilipNiedzwiadek avatar Dec 23 '22 15:12 PhilipNiedzwiadek

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.

heckedbyfurki avatar Jan 29 '23 21:01 heckedbyfurki

How can i change path of the driver to location of replit's chromedriver, cause idk where's the chrome driver in replit is

TurgutHarunArslan avatar Feb 25 '23 18:02 TurgutHarunArslan

@PhilipNiedzwiadek @sebdelsol @heckedbyfurki @aasharck Have u guys found solution for this error.

Nothig00 avatar Feb 26 '23 03:02 Nothig00

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.

heckedbyfurki avatar Feb 26 '23 08:02 heckedbyfurki

@PhilipNiedzwiadek @sebdelsol @heckedbyfurki @aasharck Have u guys found solution for this error.

Read my comment above

heckedbyfurki avatar Feb 26 '23 08:02 heckedbyfurki

Okay thanks I'll try!

TurgutHarunArslan avatar Feb 26 '23 08:02 TurgutHarunArslan

@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 image how can i download same version of them?

TurgutHarunArslan avatar Feb 26 '23 09:02 TurgutHarunArslan

@heckedbyfurki sir can u pls guide in steps how to solve this error. Really sir I'm not get single step of improvement.

Nothig00 avatar Feb 26 '23 14:02 Nothig00

@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 image how can i download same version of them?

It should be driver_executable_path, not browser_executable_path

heckedbyfurki avatar Feb 26 '23 17:02 heckedbyfurki

@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 avatar Feb 27 '23 04:02 heckedbyfurki

@heckedbyfurki im now getting permission denied

TurgutHarunArslan avatar Feb 27 '23 12:02 TurgutHarunArslan

Normal selenium works man , uc doesnt

TurgutHarunArslan avatar Feb 28 '23 05:02 TurgutHarunArslan

@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.

Nothig00 avatar Mar 01 '23 03:03 Nothig00

Normal selenium works man , uc doesnt

Your error got fixed?

Nothig00 avatar Mar 01 '23 03:03 Nothig00

Still stuck on same error

Nothig00 avatar Mar 02 '23 14:03 Nothig00

@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 ?

TurgutHarunArslan avatar Mar 04 '23 19:03 TurgutHarunArslan

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

khoi1908vn avatar Mar 12 '23 14:03 khoi1908vn

anybody found the fix i have tried everything but it just doesnt work

cheemzboi avatar Sep 22 '23 06:09 cheemzboi

I have solved this - see https://stackoverflow.com/questions/71201650/

realZyxxy avatar Dec 06 '23 23:12 realZyxxy

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:

  1. 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)

  1. 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

  2. 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!

Jediweirdo avatar Jan 19 '24 16:01 Jediweirdo