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.64k stars 1.14k forks source link

cannot connect to chrome in Linux Ubuntu 22.04 #729

Open kisoo opened 2 years ago

kisoo commented 2 years ago

My Env is Ubuntu 22.04 Server Install (Non X Window) Google Chrome: 103.0.5060.114 (Latest version) Python: 3.10.4

My Dsektop: windows 10 X Server: vcxrv 64.1.20.14.0

Case 1. ssh connect with user A (wheel group) run my script with Chrome Browser in GUI (X Window) --> works fine

Case 2. ssh connect with user A (wheel group) run my script with headless mode --> works fine

Case 3. ssh connect with user jenkins (jenkins group) run my script with Chrome Browser in GUI (X Window) --> works fine

Problem Case 4. ssh connect with user jenkins (jenkins group) run my script with headless mode --> connect error message

--- Error Message is Traceback (most recent call last): File "/opt/websystemcheck/dbinc-portal.py", line 574, in driver = init_driver() File "/opt/websystemcheck/dbinc-portal.py", line 28, in init_driver driver = uc.Chrome(options=options) File "/usr/local/lib/python3.10/dist-packages/undetected_chromedriver/init.py", line 401, in init super(Chrome, self).init( File "/usr/local/lib/python3.10/dist-packages/selenium/webdriver/chrome/webdriver.py", line 69, in init super().init(DesiredCapabilities.CHROME['browserName'], "goog", File "/usr/local/lib/python3.10/dist-packages/selenium/webdriver/chromium/webdriver.py", line 92, in init super().init( File "/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/webdriver.py", line 277, in init self.start_session(capabilities, browser_profile) File "/usr/local/lib/python3.10/dist-packages/undetected_chromedriver/init.py", line 589, in start_session super(selenium.webdriver.chrome.webdriver.WebDriver, self).start_session( File "/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/webdriver.py", line 370, in start_session response = self.execute(Command.NEW_SESSION, parameters) File "/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/webdriver.py", line 435, in execute self.error_handler.check_response(response) File "/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/errorhandler.py", line 247, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: unknown error: cannot connect to chrome at 127.0.0.1:52731 from chrome not reachable Stacktrace:

0 0x560409d18b13

1 0x560409b1f51f

2 0x560409b0eb59

3 0x560409b4739f

4 0x560409b3f256

5 0x560409b7a64a

6 0x560409b747a3

7 0x560409b4a0ea

8 0x560409b4b225

9 0x560409d602dd

10 0x560409d642c7

11 0x560409d4a22e

12 0x560409d650a8

13 0x560409d3ebc0

14 0x560409d816c8

15 0x560409d81848

16 0x560409d9bc0d

17 0x7fb2b7aa4b43

kisoo commented 2 years ago

Case 5. ssh connect with user jenkins (add to wheel group) run my script with headless mode --> works fine

bibs2091 commented 2 years ago

I downgraded my chrome browser to match my webdriver and it solved the problem!

zsbai commented 2 years ago

Google Chrome 104.0.5112.101 ChromeDriver 104.0.5112.79 (3cf3e8c8a07d104b9e1260c910efb8f383285dc5-refs/branch-heads/5112@{#1307} options.add_argument('--headless') and i still get this error. selenium.common.exceptions.WebDriverException: Message: unknown error: cannot connect to chrome at 127.0.0.1:47925 from chrome not reachable