Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot instance chromedriver in Version 127.0.6533.73 #664

Open
ManuelSalaz opened this issue Jul 23, 2024 · 18 comments
Open

cannot instance chromedriver in Version 127.0.6533.73 #664

ManuelSalaz opened this issue Jul 23, 2024 · 18 comments

Comments

@ManuelSalaz
Copy link

ManuelSalaz commented Jul 23, 2024

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

@7r5
Copy link

7r5 commented Jul 24, 2024

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'

@rozon
Copy link

rozon commented Jul 24, 2024

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'

@7r5
Copy link

7r5 commented Jul 24, 2024

some notes:

@semin204
Copy link

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.

@UPBKRATOS
Copy link

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)

@JERisBRISK
Copy link

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...

@Hasnain-20
Copy link

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.

@netexpoarthur
Copy link

netexpoarthur commented Jul 24, 2024

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 :)) !

@MaysonLedur
Copy link

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.

@netexpoarthur
Copy link

@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

@MaysonLedur
Copy link

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

@xiaowangAndyismengxin
Copy link

xiaowangAndyismengxin commented Jul 27, 2024

you can try to update. try this https://storage.googleapis.com/chrome-for-testing-public/127.0.6533.73/win64/chromedriver-win64.zip. find it in https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json, Find the version that is closest to the latest version. then change the version number by youself. open it. and now you can download the latest version.

@Nimish05Z
Copy link

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

@chipolinkin
Copy link

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

@ManuelSalaz
Copy link
Author

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
Copy link
Author

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)

@jnhyperion
Copy link

jnhyperion commented Jul 31, 2024

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

@alpcanm
Copy link

alpcanm commented Sep 18, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests