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

Amendment to __get_binary in driver_cache.py #663

Closed
pjm002 opened this issue Jul 23, 2024 · 6 comments
Closed

Amendment to __get_binary in driver_cache.py #663

pjm002 opened this issue Jul 23, 2024 · 6 comments

Comments

@pjm002
Copy link

pjm002 commented Jul 23, 2024

Distributed in chromedriver-linux64.zip is a new file called THIRD_PARTY_NOTICES.chromedriver.

This causes a problem as the current code for __get_binary in driver_cache.py loops through the files in relevant directory which consist of chromedriver, LICENSE.chromedriver and THIRD_PARTY_NOTICES.chromedriver.

The problem is that the existing code is not aware of the new file (i.e. THIRD_PARTY_NOTICES.chromedriver) and therefore picks this file as the executable which it is not.

The original code was as follows:

def __get_binary(self, files, driver_name):
    if not files:
        raise Exception(f"Can't find binary for {driver_name} among {files}")

    if len(files) == 1:
        return files[0]

    for f in files:
        if 'LICENSE' in f:
            continue
        if driver_name in f:
            return f

My fix is to update this code as follows:

def __get_binary(self, files, driver_name):
    if not files:
        raise Exception(f"Can't find binary for {driver_name} among {files}")

    if len(files) == 1:
        return files[0]

    for f in files:
        if 'LICENSE' in f:
            continue
        if 'THIRD_PARTY' in f:
            continue

        if driver_name in f:
            return f

Apologies - I don't know how to get this amendment into the source

@izharus
Copy link

izharus commented Jul 23, 2024

I encountered the same issue, and the same solution worked for me.

@cluisquijada
Copy link

Yeah, same issue here. Is there a workaround for this?

@UPBKRATOS
Copy link

I just came across with this thread, someone else just opened an issue, #664 (comment), yeah, would be great to find someone how has written access to create a quick MR and fix the issue

@pjm002
Copy link
Author

pjm002 commented Jul 24, 2024

The fix is in the code detailed above in __get_driver() i.e. to add the following line:

if 'THIRD_PARTY' in f:
continue

On my debian 12 machine the driver_cache.py file is located in /usr/local/lib/python3.11/dist-packages/webdriver_manager/core

Let me know if you have any issues and I will see if I can help and/or send you the revised driver_cache.py file.

@pjm002
Copy link
Author

pjm002 commented Jul 24, 2024

Same issue has been raised with #665 and #664

@Jheesbrough
Copy link
Contributor

Opened PR, #666 - Spooky!

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

5 participants