-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
github code to download latest chromedriver
- Loading branch information
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
def update_chromedriver(): | ||
print("\nOld driver detected. Please wait while we download the latest driver") | ||
import requests | ||
import wget | ||
import zipfile | ||
import os | ||
|
||
# get the latest chrome driver version number | ||
url = 'https://chromedriver.storage.googleapis.com/LATEST_RELEASE' | ||
response = requests.get(url) | ||
version_number = response.text | ||
|
||
# build the donwload url | ||
download_url = "https://chromedriver.storage.googleapis.com/" + version_number +"/chromedriver_win32.zip" | ||
|
||
print("Downloading chromedriver version " + str(version_number)) | ||
# download the zip file using the url built above | ||
latest_driver_zip = wget.download(download_url,'chromedriver.zip') | ||
|
||
# extract the zip file | ||
with 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 above | ||
os.remove(latest_driver_zip) | ||
print("\nDownload Complete") |