Issue
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?
Solution
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
Answered By - cruisepandey
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.