iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
😌

Error caused by version mismatch between Chrome and ChromeDriver

に公開

Overview

I am using Selenium for scraping.
I thought the program wasn't working... only to find out that Chrome had automatically updated and was no longer compatible with the ChromeDriver version (even though it was working just an hour ago...). I cannot share the code, but I'm writing this down as a memo.

$ python3 sc.py
(omitted)
selenium.common.exceptions.SessionNotCreatedException: Message: 
session not created: This version of ChromeDriver only supports Chrome version 84

# ChromeDriver installed as binary
$ chromedriver --version
ChromeDriver 84.0.4147.30

# Current Chrome version
$ google-chrome --version
Google Chrome 86.0.4240.75

# Installing ChromeDriver
$ pip install chromedriver-binary==86.0.4240.22
Successfully installed chromedriver-binary-86.0.4240.22.0

Since I installed ChromeDriver via pip this time, I added the following to my program (scr.py):
import chromedriver_binary

I also removed the executable_path parameter and everything after it from:
driver = webdriver.Chrome(options=options, executable_path=r'/usr/local/bin/chromedriver')

References

Discussion