flathunters / flathunter

A bot to help people with their rental real-estate search. 🏠🤖

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This version of ChromeDriver only supports Chrome version 114

silasburger opened this issue · comments

selenium.common.exceptions.WebDriverException: Message: unknown error: cannot connect to chrome at 127.0.0.1:62675
from session not created: This version of ChromeDriver only supports Chrome version 114

I'm getting this error when running python flathunt.py

What is the easiest way to resolve this issue? I'm using Chrome version 116, so should I simply downgrade?

Hey @silasburger,

This issue often comes up when there's a new version of Chrome. You can try clearing your Webdriver Manager cache (~/.wdm) and see if that clears up the issue. You shouldn't need to downgrade.

I just saw this message on my machine too. In my case, I have both Chromium and Google Chrome installed, and they are currently at different versions. This seems to confuse the version detection (and I don't exactly know why yet). But bringing your Chrome and Chromium versions inline, or uninstalling one of them, might help.

This comment fixed it for me: ultrafunkamsterdam/undetected-chromedriver#1491 (comment)

in chrome_wrapper.py change the code to:

def get_chrome_driver(driver_arguments):
    """Configure Chrome WebDriver"""
    logger.info('Initializing Chrome WebDriver for crawler...')
    driver_exec_path = ChromeDriverManager().install()
    chrome_options = uc.ChromeOptions() # pylint: disable=no-member
    if driver_arguments is not None:
        for driver_argument in driver_arguments:
            chrome_options.add_argument(driver_argument)
    chrome_version = get_chrome_version()
    driver = uc.Chrome(driver_executable_path=driver_exec_path, version_main=chrome_version, options=chrome_options) # pylint: disable=no-member

    driver.execute_cdp_cmd('Network.setBlockedURLs',
        {"urls": ["https://api.geetest.com/get.*"]})
    driver.execute_cdp_cmd('Network.enable', {})
    return driver

Okay. Linking this to #439 . There seems to be an issue with undetected_chromedriver for versions of Chrome beyond 114 right now. Looks like some change in the release process at Google - there's a PR in undetected_chrome that hasn't yet been merged: ultrafunkamsterdam/undetected-chromedriver#1478 . Until that's in, either downgrade to 114, or apply some of the patches in the undetected_chromedriver issues threads.

commented

u can use
hansalemaos 's auto downloader , it fixes the issue, and it works.

I patched it to work for OSX as well, prob works for linux and windows as well.

ultrafunkamsterdam/undetected-chromedriver#1491

from auto_download_undetected_chromedriver import download_undetected_chromedriver
import undetected_chromedriver as uc

folder_path = "./"
chromedriver_path = download_undetected_chromedriver(folder_path, undetected=True, arm=False, force_update=True)
driver = uc.Chrome(driver_executable_path=chromedriver_path)

use any path as a destination folder, you can even put "./" for the current script's folder 👍

For Mac Arm users, just download Chromium 114. It worked again for me.

https://storage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Mac_Arm/1134699/

Before opening you might execute in terminal: xattr -cr /Applications/Chromium.app

Just merged #454, which bumps undetected-chromedriver to a version that should support the latest chrome. Please retest and check if this resolves your issues - thanks!

I retested but I'm getting another error related to undetected_chromedriver.

Traceback (most recent call last):
  File "/Users/silas.burger/flathunter/flathunt.py", line 99, in <module>
    main()
  File "/Users/silas.burger/flathunter/flathunt.py", line 95, in main
    launch_flat_hunt(config, heartbeat)
  File "/Users/silas.burger/flathunter/flathunt.py", line 35, in launch_flat_hunt
    hunter.hunt_flats()
  File "/Users/silas.burger/flathunter/flathunter/hunter.py", line 56, in hunt_flats
    for expose in processor_chain.process(self.crawl_for_exposes(max_pages)):
  File "/Users/silas.burger/flathunter/flathunter/hunter.py", line 35, in crawl_for_exposes
    return chain(*[try_crawl(searcher, url, max_pages)
  File "/Users/silas.burger/flathunter/flathunter/hunter.py", line 35, in <listcomp>
    return chain(*[try_crawl(searcher, url, max_pages)
  File "/Users/silas.burger/flathunter/flathunter/hunter.py", line 27, in try_crawl
    return searcher.crawl(url, max_pages)
  File "/Users/silas.burger/flathunter/flathunter/abstract_crawler.py", line 151, in crawl
    return self.get_results(url, max_pages)
  File "/Users/silas.burger/flathunter/flathunter/crawler/immobilienscout.py", line 90, in get_results
    soup = self.get_page(search_url, self.get_driver(), page_no)
  File "/Users/silas.burger/flathunter/flathunter/crawler/immobilienscout.py", line 65, in get_driver
    self.driver = get_chrome_driver(driver_arguments)
  File "/Users/silas.burger/flathunter/flathunter/chrome_wrapper.py", line 47, in get_chrome_driver
    driver = uc.Chrome(version_main=chrome_version, options=chrome_options) # pylint: disable=no-member
  File "/Users/silas.burger/.local/share/virtualenvs/flathunter-_6i_efwC/lib/python3.10/site-packages/undetected_chromedriver/__init__.py", line 251, in __init__
    self.patcher = Patcher(
  File "/Users/silas.burger/.local/share/virtualenvs/flathunter-_6i_efwC/lib/python3.10/site-packages/undetected_chromedriver/patcher.py", line 65, in __init__
    self.is_old_chromedriver = version_main and version_main <= 114
TypeError: '<=' not supported between instances of 'str' and 'int'

Hmm. Well, that's new. But I guess you could try converting the value passed in in chrome_wrapper so that it's explicitly parsed as an int before it goes into undetected_chromedriver. Does that fix your issue?

That did fix my issue 🤷

Please send a PR :)

Sent 👍 (failed tests)

Should be resolved by #460