Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

THIRD_PARTY_NOTICES.chromedriver - Exec format error - undetected_chromedriver

undetected_chromedriver with webdriver_manager was working well few days ago for scraping websites but out of nowhere it started throwing the error:

OSError: [Errno 8] Exec format error: 
'/Users/pd/.wdm/drivers/chromedriver/mac64/127.0.6533.72/chromedriver-mac-x64/THIRD_PARTY_NOTICES.chromedriver'

I am guessing it is related to recent update of webdriver_manager.

This is the code:

import undetected_chromedriver as uc
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.support import expected_conditions as EC

def get_driver():
    options = uc.ChromeOptions()
    # options.add_argument("--headless")
    options.add_argument("--no-sandbox")
    options.add_argument("--disable-dev-sim-usage")
    options.add_argument("--start-maximized")
    options.add_argument('--disable-popup-blocking')
    driver = uc.Chrome(driver_executable_path=ChromeDriverManager().install(), options=options, version_main=116)
    driver.maximize_window()
    return driver

It would be really great if someone can help me on this, Thanks.

like image 366
Prakash Dahal Avatar asked Dec 02 '25 12:12

Prakash Dahal


2 Answers

The command ChromeDriverManager().install():

  1. creates a new folder without the executable and
  2. it retrieves the wrong file.

enter image description here

First, you need to remove the .wdm folder and then reinstall webdriver-manager:

Windows Location: r"C:\Users\{user}\.wdm"

Linux Location: /home/{user}/.wdm

Mac Location: /Users/{user}/.wdm

rm -rf /home/user/.wdm
pip uninstall webdriver-manager
pip install webdriver-manager

Now, after executing ChromeDriverManager().install(), you should only see a single folder with the executable:

enter image description here

It check if there is really a chromedriver executable inside this folder.

Second, it makes a correction to the file name:

if 'THIRD_PARTY_NOTICES.chromedriver' in chromedriver_path:
    chromedriver_path = chromedriver_path.replace('THIRD_PARTY_NOTICES.chromedriver', 'chromedriver')
like image 107
Denis da Mata Avatar answered Dec 04 '25 02:12

Denis da Mata


The issue was fixed in the latest 4.0.2 release. See this commit on `webdriver_ma for details.

like image 20
Gilbert Williams Avatar answered Dec 04 '25 02:12

Gilbert Williams



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!