Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Issue with Selenium and webdriver

I'm trying to use the webdriver and Selenium, it was working fine a couple days ago but I'm currently facing this issue where I receive this error: [Errno 8] Exec format error: '/Users/[USER]/.wdm/drivers/chromedriver/mac64/127.0.6533.72/chromedriver-mac-arm64/THIRD_PARTY_NOTICES.chromedriver'

Here is the relevant portion of code that relates to this:

            options = webdriver.ChromeOptions()
            options.add_argument("--headless")
            options.add_argument("--no-sandbox")
            options.add_argument("--disable-dev-shm-usage")
            d_path = ChromeDriverManager().install()
            driver = webdriver.Chrome(service=Service(d_path), options=options)

I have tried to manually change the d_path by replacing the 'THIRD_PARTY_NOTICES.chromedriver' with 'chromedriver' but that in itself also does not work.

like image 593
toprak Avatar asked Mar 21 '26 09:03

toprak


2 Answers

Maybe is not the best solution, but, I solved it updating/installing a clean version of the webdriver-manager (min 4.0.2 version):

pip uninstall webdriver-manager
pip install webdriver-manager

And after it, removing the last entry of the drivers.json file (/Users/xxxx/.wdm/drivers.json):

"mac64_chromedriver_127.0.6533.72_for_127.0.6533": {
    "timestamp": "26/07/2024",
    "binary_path": "/Users/Alejandro/.wdm/drivers/chromedriver/mac64/127.0.6533.72/chromedriver-mac-x64/THIRD_PARTY_NOTICES.chromedriver"
}
like image 93
A. González Avatar answered Mar 24 '26 09:03

A. González


I also got the same issue, was banging my head around it. Trying to install specific versions.

Ultimately the fix was to update webdriver-manager package to v4.0.2

They have fixed the issue so that correct file is chosen as driver.

like image 27
W1nTer003 Avatar answered Mar 24 '26 10:03

W1nTer003