I am starting to play around with selenium in python, and when i try to run this code it just pops an error that this version of chromedriver only supports version 74 of chrome, but I already downloaded version 74 from here: https://chromedriver.storage.googleapis.com/index.html?path=74.0.3729.6/
The code i am trying to run:
import selenium
from selenium import webdriver
driver = webdriver.Chrome()
driver.get('https://stackoverflow.com')
driver.quit()
The error:
Traceback (most recent call last):
File "c:/Users/Main/Desktop/Python web bot/Bot
code/selenium_training.py", line 3, in <module>
driver = webdriver.Chrome()
File "C:\Users\Main\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 81, in __init__
desired_capabilities=desired_capabilities)
File "C:\Users\Main\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in __init__
self.start_session(capabilities, browser_profile)
File "C:\Users\Main\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "C:\Users\Main\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Users\Main\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 74
(Driver info: chromedriver=74.0.3729.6 (255758eccf3d244491b8a1317aa76e1ce10d57e9-refs/branch-heads/3729@{#29}),platform=Windows NT 10.0.17134 x86_64)
As you can see, it says that I need version 74 chrome, but i already have it!
This error message...
...implies that the ChromeDriver expects the Chrome Browser version to be 74.
Your main issue is the incompatibility between the version of the binaries you are using as follows:
Presumably you have multiple versions of Chrome browsers installed within your system and the version of Chrome browser installed at the default location which is accessed by chromedriver=74.0.3729.6 is not Chrome Browser v74.0. Hence you see the error.
Solution
The quickest solution would be to upgrade Chrome version installed at the default location to Chrome v74 level.
Alternative
As an alternative, if you want to use the Chrome browser binary installed in a non-standard location you can use an instance of
ChromeOptions()
with thebinary_location
property to point to the non-standard Chrome Browser location as follows:Reference
You can find a relevant detailed discussion in:
Run a search on your computer for "chromedriver" files, then delete all the searched files and copy the latest driver in your desired driver folder. This will solve the issue.
Simply go to chrome and check the version of chrome in your PC. (help -> About Chrome) Download the same version ChromeDriver from the below link ...
https://sites.google.com/a/chromium.org/chromedriver/downloads
then extract it and do paste in your script folder.
This most commonly happens when chrome itself updates, but you have not updated the local ChromeDriver version to match your locally installed version of chrome.
In chrome, click the three dots, in the upper right, Help --> About Google Chrome. this will show your version of chrome. Or chrome://settings/help
Download the same version from https://chromedriver.storage.googleapis.com/index.html
Save that to the path defined, as in @DebanjanB's answer.