ultrafunkamsterdam / undetected-chromedriver

Custom Selenium Chromedriver | Zero-Config | Passes ALL bot mitigation systems (like Distil / Imperva/ Datadadome / CloudFlare IUAM)
https://github.com/UltrafunkAmsterdam/undetected-chromedriver
GNU General Public License v3.0
9.97k stars 1.16k forks source link

Headless mode does not work on Ubuntu without X11 #353

Open rl1987 opened 3 years ago

rl1987 commented 3 years ago

I tried running it on Digital Ocean Ubuntu droplet with Google Chrome installed from official .deb package, but was getting an error.

>>> import undetected_chromedriver as uc
/usr/lib/python3/dist-packages/requests/__init__.py:89: RequestsDependencyWarning: urllib3 (1.26.7) or chardet (3.0.4) doesn't match a supported version!
  warnings.warn("urllib3 ({}) or chardet ({}) doesn't match a supported "
>>> uc.install()
>>> options = uc.ChromeOptions()
>>> options.headless=True
>>> options.add_argument('--headless')
>>> chrome = uc.Chrome(options=options)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.8/dist-packages/undetected_chromedriver/__init__.py", line 57, in __new__
    instance.__init__(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/selenium/webdriver/chrome/webdriver.py", line 69, in __init__
    super(WebDriver, self).__init__(DesiredCapabilities.CHROME['browserName'], "goog",
  File "/usr/local/lib/python3.8/dist-packages/selenium/webdriver/chromium/webdriver.py", line 93, in __init__
    RemoteWebDriver.__init__(
  File "/usr/local/lib/python3.8/dist-packages/selenium/webdriver/remote/webdriver.py", line 248, in __init__
    self.start_session(capabilities, browser_profile)
  File "/usr/local/lib/python3.8/dist-packages/selenium/webdriver/remote/webdriver.py", line 339, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/usr/local/lib/python3.8/dist-packages/selenium/webdriver/remote/webdriver.py", line 400, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python3.8/dist-packages/selenium/webdriver/remote/errorhandler.py", line 236, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally.
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Stacktrace:
#0 0x55975debf463 <unknown>
#1 0x55975d997678 <unknown>
#2 0x55975d9ba892 <unknown>
#3 0x55975d9b63bd <unknown>
#4 0x55975d9f0480 <unknown>
#5 0x55975d9ea683 <unknown>
#6 0x55975d9c0b64 <unknown>
#7 0x55975d9c1b55 <unknown>
#8 0x55975deef0fe <unknown>
#9 0x55975df049d0 <unknown>
#10 0x55975def0055 <unknown>
#11 0x55975df05e18 <unknown>
#12 0x55975dee482b <unknown>
#13 0x55975df20f98 <unknown>
#14 0x55975df21118 <unknown>
#15 0x55975df3c59d <unknown>
#16 0x7f59ba897609 <unknown>

>>> 
xidios commented 2 years ago

same problem

taiji-xo commented 2 years ago

same problem