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

cannot connect to chrome in Linux Ubuntu 22.04

Open kisoo opened this issue 1 year ago • 3 comments

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 avatar Jul 18 '22 09:07 kisoo

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

kisoo avatar Jul 18 '22 09:07 kisoo

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

bibs2091 avatar Jul 31 '22 23:07 bibs2091

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

zsbai avatar Aug 21 '22 09:08 zsbai