undetected-chromedriver
undetected-chromedriver copied to clipboard
version_main and driver_executable_path not working
Its only download the lastest chromedriver but not accept version_main and driver_executable_path
I'm also having the issue of version_main not working!
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!
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)
I recently needed to detect chrome version and this gist helped me a lot. Hope it'll be helpful.