How to work with a specific version of ChromeDriver while Chrome Browser gets updated automatically through Python selenium
No, there is no other alternative than updating the ChromeDriver binary versions, while the Chrome Browser keeps on getting updated automatically.
Reason
Each Chrome Browser is released after certain feature additions, modifications and removals from the existing features. To comply with the current set of Browser Features, Chrome Team releases the compatible ChromeDriver binary time to time. These ChromeDriver binaries are capable to interact with the Chrome Browser. Certain version of a ChromeDriver binary supports a specific range of Chrome Browser versions (some of the recent) as below:
ChromeDriver v84.0.4147.30 (2020-05-28)
Supports Chrome version 84
ChromeDriver v83.0.4103.39 (2020-05-05)
Supports Chrome version 83
ChromeDriver v82 was intensionally skipped.
ChromeDriver v81.0.4044.138 (2020-05-05)
Supports Chrome version 81
ChromeDriver v80.0.3987.106 (2020-02-13)
Supports Chrome version 80
ChromeDriver v79.0.3945.36 (2019-11-18)
Supports Chrome version 79
ChromeDriver v78.0.3904.70 (2019-10-21)
Supports Chrome version 78
ChromeDriver v77.0.3865.40 (2019-08-20)
Supports Chrome version 77
ChromeDriver v76.0.3809.126 (2019-08-20)
Supports Chrome version 76
ChromeDriver v75.0.3770.8 (2019-04-29)
Supports Chrome version 75
ChromeDriver v74.0.3729.6 (2019-03-14)
Supports Chrome version 74
ChromeDriver v73.0.3683.68 (2019-03-06)
Supports Chrome version 73
ChromeDriver v2.46 (2019-02-01)
Supports Chrome v71-73
ChromeDriver v2.45 (2018-12-10)
Supports Chrome v70-72
ChromeDriver v2.44 (2018-11-19)
Supports Chrome v69-71
ChromeDriver v2.43 (2018-10-16)
Supports Chrome v69-71
ChromeDriver v2.42 (2018-09-13)
Supports Chrome v68-70
ChromeDriver v2.41 (2018-07-27)
Supports Chrome v67-69
ChromeDriver v2.40 (2018-06-07)
Supports Chrome v66-68
ChromeDriver v2.39 (2018-05-30)
Supports Chrome v66-68
ChromeDriver v2.38 (2018-04-17)
Supports Chrome v65-67
ChromeDriver v2.37 (2018-03-16)
Supports Chrome v64-66
ChromeDriver v2.36 (2018-03-02)
Supports Chrome v63-65
ChromeDriver v2.35 (2018-01-10)
Supports Chrome v62-64
ChromeDriver v2.34 (2017-12-10)
Supports Chrome v61-63
ChromeDriver v2.33 (2017-10-03)
Supports Chrome v60-62
ChromeDriver v2.32 (2017-08-30)
Supports Chrome v59-61
ChromeDriver v2.31 (2017-07-21)
Supports Chrome v58-60
ChromeDriver v2.30 (2017-06-07)
Supports Chrome v58-60
ChromeDriver v2.29 (2017-04-04)
Supports Chrome v56-58
Conclusion
To keep your script/program interactive with the updated Chrome Browser you have to keep the version of ChromeDriver binary in sync with the Chrome Browser as per the compatibility.
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 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"
# 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)
How to fix the chromedriver if its not compatible with chrome version?
You can download and use the latest ChromeDriver automatically using webdrivermanager-python.
This can be achieved by installing the webdriver-manager using the command:
pip install webdriver-manager
Implemention through code:
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
driver = webdriver.Chrome(ChromeDriverManager().install())
driver.get("https://www.google.com/")
Related Topics
Performance of Pandas Apply VS Np.Vectorize to Create New Column from Existing Columns
Is There a Built in Package to Parse HTML into Dom
Connect Wifi with Python or Linux Terminal
Placing Custom Images in a Plot Window--As Custom Data Markers or to Annotate Those Markers
How to Define a Threshold Value to Detect Only Green Colour Objects in an Image with Python Opencv
Python Date String to Date Object
Opencv Giving Wrong Color to Colored Images on Loading
Matplotlib Plots: Removing Axis, Legends and White Spaces
How to Test the Membership of Multiple Values in a List
What Is the Purpose of a Backslash at the End of a Line
How to Find All Comments with Beautiful Soup
Python Linux Dmidecode, How to Obtain Hw Info by Parsing
Loading .Rdata Files into Python
Unboundlocalerror with Nested Function Scopes
Django Set Default Form Values
Transpose Column to Row with Spark
Remove All Special Characters, Punctuation and Spaces from String