If the version of the chrome driver is different from the current chrome version, I want to write a python code that downloads and operates the chrome driver that matches the current chrome version.
This is all I've been looking for
driver = webdriver.Chrome(ChromeDriverManage().install(), chrome_options=chrome_options)
I think this code is inefficient because i have to install the chrome driver every time. Is there any way?
This is what the official docs says :
you can do
pip install chromedriver-autoinstaller
or
Import
import chromedriver_autoinstaller
Code :
from selenium import webdriver
import chromedriver_autoinstaller
chromedriver_autoinstaller.install()  # Check if the current version of chromedriver exists
                                      # and if it doesn't exist, download it automatically,
                                      # then add chromedriver to path
driver = webdriver.Chrome()
driver.get("http://www.python.org")
assert "Python" in driver.title
Reference : click here
The chromedriver-autoinstaller library has worked well for me and uses a cache so it doesn't needlessly redownload the driver.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With