Undetected Chromedriver not using most recent chromedriver for my browser – Python

by
Ali Hasan
llama-cpp-python selenium-webdriver undetected-chromedriver

Quick Fix: Utilize SeleniumBase’s UC Mode as an alternative, which has a modified version of undetected-chromedriver. Install SeleniumBase with ‘pip install seleniumbase’ and run the script with ‘from seleniumbase import Driver; driver = Driver(uc=True); driver.get("https://nowsecure.nl/#relax"); time.sleep(6); driver.quit()’.

The Problem:

I’m having difficulty updating my undetected_chromedriver to the latest version, which is Chromium 116.0.5845.96. Despite my attempts to reinstall the module, the browsers, and even utilizing the version_main=116 parameter, the issue persists. The version_main parameter appears to be limited to 114, preventing me from accessing the desired version. When I launch the code using Chrome Version 116.0.5845.97 (Official Build) (64-bit), I encounter an error message stating that the ChromeDriver only supports Chrome version 114.

The Solutions:

Solution 1: Manually downloading the latest UNDETECTED_CHROMEDRIVER version

To manually download the latest version of the UNDETECTED_CHROMEDRIVER, you can follow these steps:

  1. First, check the official detected-chromedriver GitHub page to find the latest released version.
  2. Then, download the correct version of the driver for your operating system (Windows, Mac, or Linux).
  3. Once downloaded, extract the driver to a folder on your computer (e.g., “C:\undetected_chromedriver”).
  4. Now, you need to set the UNDETECTED_CHROMEDRIVER_PATH environment variable to point to the extracted folder. To do this:
    • On Windows, right-click on “My Computer” and select “Properties.” Then, click on “Advanced system settings” and then on the “Environment Variables” button.
    • On Mac, open the “Terminal” app and type the following command:
      export UNDETECTED_CHROMEDRIVER_PATH="/path/to/undetected_chromedriver"
      (Replace “/path/to/undetected_chromedriver” with the actual path to the extracted folder.)

Now, you can use the downloaded version of UNDETECTED_CHROMEDRIVER from this path.

Here is an example code that shows how to use the downloaded UNDETECTED_CHROMEDRIVER:

import undetected_chromedriver as uc

driver = uc.Chrome()
driver.get('https://www.example.com')

# Do your automation here

driver.quit()

\n

Solution 2: Uninstalling and then reinstalling the ‘undetected_chromedriver’ package

\n

The steps below helped fix the issue of undetected_chromedriver not using the most recent chromedriver for the browser:

  1. Uninstall the ‘undetected_chromedriver’ package using the command:
    pip uninstall undetected_chromedriver
    
  2. Reinstall the ‘undetected_chromedriver’ package with the updated version using the command:
    pip install undetected_chromedriver
    

Q&A

Why does undetected_chromedriver not use the most recent chromedriver for my browser version?

Reported as an open issue on GitHub.

Is there a way to use undetected_chromedriver with the most recent, unsupported browser version?

SeleniumBase can be used as an alternative.

Is there a more permanent solution to this issue?

Uninstalling and reinstalling undetected_chromedriver may work.

Video Explanation:

The following video, titled "Undetectable automation with SeleniumBase UC Mode and ...", provides additional insights and in-depth exploration related to the topics discussed in this post.

Play video

Undetectable automation with SeleniumBase UC Mode and undetected-chromedriver. (Python) 0:00 - Welcome / Introduction 0:35 - Live Demos of ...