Automatic download of appropriate chromedriver for Selenium in Python Automatic download of appropriate chromedriver for Selenium in Python selenium selenium

Automatic download of appropriate chromedriver for Selenium in Python


Here is the other solution, where webdriver_manager does not support. This script will get the latest chrome driver version downloaded.

import requestsimport wgetimport zipfileimport os# get the latest chrome driver version numberurl = 'https://chromedriver.storage.googleapis.com/LATEST_RELEASE'response = requests.get(url)version_number = response.text# build the donwload urldownload_url = "https://chromedriver.storage.googleapis.com/" + version_number +"/chromedriver_win32.zip"# download the zip file using the url built abovelatest_driver_zip = wget.download(download_url,'chromedriver.zip')# extract the zip filewith zipfile.ZipFile(latest_driver_zip, 'r') as zip_ref:    zip_ref.extractall() # you can specify the destination folder path here# delete the zip file downloaded aboveos.remove(latest_driver_zip)


Here is one more wayFor Python -

import chromedriver_autoinstallerfrom selenium import webdriveropt = webdriver.ChromeOptions()opt.add_argument("--start-maximized")chromedriver_autoinstaller.install()driver = webdriver.Chrome(options=opt)driver.get('https://stackoverflow.com/')

here is more info

https://pypi.org/project/chromedriver-autoinstaller/