Python Forum
ChromeDriver breaking Python script - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: ChromeDriver breaking Python script (/thread-41753.html)



ChromeDriver breaking Python script - genericusername12414 - Mar-14-2024

Have an old script im trying to run. It uses "chromedriver.exe" to run. Every once in a while when chrome updates it breaks the app and id have to go to the chromedriver website, download the latest chromedriver.exe and replace the old one in my python script folder and it works.

When I run my python script it gives the error: "chromedriver version 114 not compatible with chrome ver 122 - chromedriver 122.06.6261.128 is recommended for chrome 122". However, on the chromedriver site it looks like after ChromeDriver 114 they no longer have .exe but zip files with a bunch of files inside.

Any ideas how i Can get chromedriver.exe version 122 to get my script running again?

Thank you.


RE: ChromeDriver breaking Python script - snippsat - Mar-14-2024

The link to driver is now in a Json file JSON API endpoints last-known-good-versions-with-downloads.json.
Example.
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
import time

# Setup
# https://storage.googleapis.com/chrome-for-testing-public/122.0.6261.128/win64/chromedriver-win64.zip
options = Options()
options.add_argument("--headless=new")
ser = Service(r"C:\cmder\bin\chromedriver.exe")
browser = webdriver.Chrome(service=ser, options=options)
# Parse or automation
url = 'https://www.python.org/'
browser.get(url)
python_about = browser.find_element(By.CSS_SELECTOR, '#touchnav-wrapper > header > div > div.introduction > p')
print(python_about.text)
Output:
Python is a programming language that lets you work quickly and integrate systems more effectively. Learn More