webdriver_manager icon indicating copy to clipboard operation
webdriver_manager copied to clipboard

cannot instance chromedriver in Version 127.0.6533.73

Open ManuelSalaz opened this issue 1 year ago • 17 comments

from webdriver_manager.chrome import ChromeDriverManager
from selenium import webdriver
from selenium.webdriver.chrome.service import Service as ChromeService
chrome_service = ChromeService(ChromeDriverManager().install())
driver = webdriver.Chrome(service=chrome_service)

Console Output: OSError: [WinError 193] %1 is not a valid Win32 application

ManuelSalaz avatar Jul 23 '24 23:07 ManuelSalaz

I have the same issue, but using python I got this error: HOOK-ERROR in before_scenario: OSError: [Errno 8] Exec format error: '/root/.wdm/drivers/chromedriver/linux64/127.0.6533.72/chromedriver-linux64/THIRD_PARTY_NOTICES.chromedriver'

7r5 avatar Jul 24 '24 01:07 7r5

I'm having the same issue on mac: HOOK-ERROR in before_scenario: OSError: [Errno 8] Exec format error: '/Users/rozon/.wdm/drivers/chromedriver/mac64/127.0.6533.72/chromedriver-mac-arm64/THIRD_PARTY_NOTICES.chromedriver'

rozon avatar Jul 24 '24 01:07 rozon

some notes:

  • https://googlechromelabs.github.io/chrome-for-testing/ doesn't show the .73 version, only .72
  • you can manually enter the url the .73 version and it downloads the driver, example: https://storage.googleapis.com/chrome-for-testing-public/127.0.6533.73/mac-arm64/chromedriver-mac-arm64.zip

7r5 avatar Jul 24 '24 01:07 7r5

I had the same issue. It seems that the file path in drivers.json is incorrectly specified. Manually changing the file path from THIRD_PARTY_NOTICES.chromedriver to chromedriver.exe resolved the issue, and it is now running correctly.

semin204 avatar Jul 24 '24 02:07 semin204

I might found the issue, it seems the Latest Chrome updates (https://chromereleases.googleblog.com/) introduced a THIRD_PARTY_NOTICES file within the packed archive, having that in mind the core/driver_chage._get_binary method is just ignoring the LICENSE file hence it ended up choosing the next in the queue, that is why we see the THIRD_PARTY_NOTICES.chromedriver but that is not the executable, I don't have write access to the repo, but can someone who does, to please create a quick MR to include a logic to also ignore the third party File or pick directly the one under /chromedriver?, would be better fix it at the code level instead changing the filename manually

if any(uf in f for uf in ['LICENSE', 'THIRD_PARTY_NOTICES']):
                continue

core_driver_cache (1)

UPBKRATOS avatar Jul 24 '24 02:07 UPBKRATOS

if any(uf in f for uf in ['LICENSE', 'THIRD_PARTY_NOTICES']):
                continue

This worked for me, but I feel like it might lead to us playing 'whack a mole' if the driver folks keep adding to the archive...

JERisBRISK avatar Jul 24 '24 07:07 JERisBRISK

driver_path = ChromeDriverManager().install()
if driver_path:
    driver_name = driver_path.split('/')[-1]
    if driver_name!="chromedriver":
        driver_path = "/".join(driver_path.split('/')[:-1]+["chromedriver"])
        os.chmod(driver_path, 0o755)
driver = webdriver.Chrome(service=Service(driver_path))

Try this fix, if you don't want to make changes in Package files.

Hasnain-20 avatar Jul 24 '24 08:07 Hasnain-20

Capture d'écran 2024-07-24 100912 That’s exactly right, @semin204 . There’s an error in the module that specifies some form of documentation as the return value of ChromeDriverManager().install(), whereas it should return the absolute path of chromedriver. It looks like an intern might have accidentally pressed the wrong button :)) !

netexpoarthur avatar Jul 24 '24 08:07 netexpoarthur

I'm running the 4.0.2 version and still getting the error:

OSError: [WinError 193] %1 is not a valid Win32 application.

Should it be fixed in that version already? My code:

chrome_service = ChromeService(ChromeDriverManager().install())
chrome_options = Options()
driver = webdriver.Chrome(service=chrome_service, options=chrome_options)

The error began on the 127 chrome update.

MaysonLedur avatar Jul 26 '24 13:07 MaysonLedur

@MaysonLedur Updating the version as you've done doesn't necessarily fix the problem. In fact, the problem seems to stem from the JSON file in the Chromedriver directory. Deleting the 'drivers' folder corrected the problem for me, which should solve your problem.

C:\Users\me\.wdm\drivers\chromedriver\win64\127.0.6533.72\chromedriver-win32/chromedriver.exe

netexpoarthur avatar Jul 26 '24 16:07 netexpoarthur

netexpoarthur, thank you! That solved my problem. Have a nice one!

MaysonLedur avatar Jul 26 '24 17:07 MaysonLedur

driver_path = ChromeDriverManager().install()
if driver_path:
    driver_name = driver_path.split('/')[-1]
    if driver_name!="chromedriver":
        driver_path = "/".join(driver_path.split('/')[:-1]+["chromedriver"])
        os.chmod(driver_path, 0o755)
driver = webdriver.Chrome(service=Service(driver_path))

Try this fix, if you don't want to make changes in Package files.

If this also not works then just add .exe to chromedriver in driver_path. then that will be chromedriver.exe

Nimish05Z avatar Jul 30 '24 06:07 Nimish05Z

You should edit this json only --> drivers.json It works) fix2 fix3 fix4

chipolinkin avatar Jul 30 '24 11:07 chipolinkin

driver_path = ChromeDriverManager().install()
if driver_path:
    driver_name = driver_path.split('/')[-1]
    if driver_name!="chromedriver":
        driver_path = "/".join(driver_path.split('/')[:-1]+["chromedriver"])
        os.chmod(driver_path, 0o755)
driver = webdriver.Chrome(service=Service(driver_path))

Try this fix, if you don't want to make changes in Package files.

I got this error:

FileNotFoundError: [WinError 2] The system cannot find the file specified: 'C:\\Users\\Administrator\\.wdm\\drivers\\chromedriver\\win64\\127.0.6533.72\\chromedriver-win32/chromedriver'

ManuelSalaz avatar Jul 30 '24 18:07 ManuelSalaz

driver_path = ChromeDriverManager().install()
if driver_path:
    driver_name = driver_path.split('/')[-1]
    if driver_name!="chromedriver":
        driver_path = "/".join(driver_path.split('/')[:-1]+["chromedriver"])
        os.chmod(driver_path, 0o755)
driver = webdriver.Chrome(service=Service(driver_path))

Try this fix, if you don't want to make changes in Package files.

I got this error:

FileNotFoundError: [WinError 2] The system cannot find the file specified: 'C:\\Users\\Administrator\\.wdm\\drivers\\chromedriver\\win64\\127.0.6533.72\\chromedriver-win32/chromedriver'

Making a little change works! this is the code:

driver_path = ChromeDriverManager().install()
if driver_path:
    driver_name = driver_path.split('/')[-1]
    if driver_name!="chromedriver":
        driver_path = "/".join(driver_path.split('/')[:-1]+["chromedriver.exe"])
        os.chmod(driver_path, 0o755)

Service = ChromeService(driver_path)
driver = webdriver.Chrome(service=Service)

ManuelSalaz avatar Jul 30 '24 18:07 ManuelSalaz

I think 4.0.2 already fixed this error:

  1. update webdriver_manager to 4.0.2
  2. delete /user/user_name/.wdm/driver.json

then try again

jnhyperion avatar Jul 31 '24 06:07 jnhyperion

I replaced

"/Users/{user}/.wdm/drivers/chromedriver/mac64/128.0.6613.137/chromedriver-mac-arm64/THIRD_PARTY_NOTICES.chromedriver"

to

"/Users/{user}/.wdm/drivers/chromedriver/mac64/128.0.6613.137/chromedriver-mac-arm64/chromedriver"

just Delete "THIRD_PARTY_NOTICES."

then fixed for me.

-Mac M1

alpcanm avatar Sep 18 '24 11:09 alpcanm