undetected-chromedriver icon indicating copy to clipboard operation
undetected-chromedriver copied to clipboard

version_main and driver_executable_path not working

Open Lolmc0587 opened this issue 2 years ago • 4 comments

Its only download the lastest chromedriver but not accept version_main and driver_executable_path

Lolmc0587 avatar Jul 09 '22 09:07 Lolmc0587

I'm also having the issue of version_main not working!

metalpacoforeal avatar Jul 12 '22 14:07 metalpacoforeal

Hello, I am using a method to work 100% of the times using the latest chrome version. Made that to work inside a Docker container and undetected-chromedriver will always try to use the available chrome version

chrome_options.binary_location = uc.find_chrome_executable()

full_version = os.popen(uc.find_chrome_executable() + " --version").read()
version = full_version.replace("Google Chrome ", "").split(".")[0]

browser = uc.Chrome(options=chrome_options, version_main=version)

Hope it helps!

QuentiumYT avatar Jul 13 '22 08:07 QuentiumYT

Thanks @QuentiumYT This works on Linux (and Mac ??). On Windows it's a little more convoluted :

# Windows only... pywin32 needed : pip install pywin32
from win32api import HIWORD, GetFileVersionInfo

import undetected_chromedriver as uc

def get_chrome_main_version():
    filename = uc.find_chrome_executable()
    info = GetFileVersionInfo(filename, "\\")
    return HIWORD(info["FileVersionMS"])


if __name__ == "__main__":
    version_main = get_chrome_main_version()
    driver = uc.Chrome(version_main=version_main)

sebdelsol avatar Jul 13 '22 12:07 sebdelsol

Detect the version of Chrome installed on Windows, Linux, Mac. Cross-platform using Python, native OS detection, does not require Selenium.

I recently needed to detect chrome version and this gist helped me a lot. Hope it'll be helpful.

hasansezertasan avatar Jul 16 '22 11:07 hasansezertasan