Forums

Use package Undetected chromedriver: Cannot connect to chrome at 127.0.0.1:40165

Hello, I want to use the package undetected chromedriver. The code I'm using:

import undetected_chromedriver as uc
chrome_options = uc.ChromeOptions()
chrome_options.add_argument("--no-sandbox")
chrome_options.add_argument("--headless")
chrome_options.add_argument("--disable-gpu")
browser = uc.Chrome(options=chrome_options)
try:
    browser.get("https://www.google.com")
    print("Page title was '{}'".format(browser.title))
finally:
    browser.quit()

This is giving me this error:

WebDriverException: Message: unknown error: cannot connect to chrome at 127.0.0.1:40165
from session not created: This version of ChromeDriver only supports Chrome version 108
Current browser version is 90.0.4430.212
Stacktrace:
#0 0x561324c082a3 <unknown>
#1 0x5613249c6f77 <unknown>
#2 0x5613249f3fd7 <unknown>
#3 0x5613249eaf89 <unknown>
#4 0x561324a2c0b7 <unknown>
#5 0x561324a2ba5f <unknown>
#6 0x561324a23903 <unknown>
#7 0x5613249f6ece <unknown>
#8 0x5613249f7fde <unknown>
#9 0x561324c5863e <unknown>
#10 0x561324c5bb79 <unknown>
#11 0x561324c3e89e <unknown>
#12 0x561324c5ca83 <unknown>
#13 0x561324c31505 <unknown>
#14 0x561324c7dca8 <unknown>
#15 0x561324c7de36 <unknown>
#16 0x561324c99333 <unknown>
#17 0x7f343e5fd609 start_thread

How can I configure my PythonAnywhere account so I can use the Undetected Chromedriver package? Thanks already!

It looks that the package requires newer version of the chromedriver that is present in our system. I see they propose a solution in the package README. It also looks like it's trying to start some kind of proxy server -- that I don't think would work on PythonAnywhere.