課題
Seleniumを利用していたら次のエラーが発生するようになりました。
selenium.common.exceptions.SessionNotCreatedException: This version of ChromeDriver only supports Chrome version 114. LATEST_RELEASE_116 doesn't exist
エラーの原因
Seleniumのバージョンが古いため
対策
- Seleniumのバージョンをチェック
pip show selenium
- Seleniumのバージョンが4.11.2より古い場合はSeleniumをバージョンアップ
pip install selenium --upgrade
- コードを次のように修正
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
service = Service()
options = webdriver.ChromeOptions()
driver = webdriver.Chrome(service=service, options=options)
以上