So i'm try to get Selenium to work but i'm encountering a problem with ChromeDriver. I'm using Selenium v4.6 i have Chrome version 115.0.5790.171. I know that version 4.6 has Selenium Manager fully integrated with Selenium and can silently download the matching ChromeDriver but in my case i'm still getting the following error:
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 101 Current browser version is 115.0.5790.171 with binary path C:\Program Files\Google\Chrome\Application\chrome.exe Here is an example of a scraper that i built:
from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.by import By from selenium.webdriver.chrome.service import Service from selenium.webdriver.chrome.options import Options import pandas as pd import time custom_options = webdriver.ChromeOptions() custom_options.add_experimental_option('prefs', {'intl.accept_languages': 'en,en_US'}) service = Service() options = Options() driver = webdriver.Chrome(service=service, options=options) driver.get("https://lr.caa.cz/letecky-rejstrik?lang=en") data = [] while True: try: print("Page source:") print(driver.page_source) print("Waiting for table rows to load...") rows_length = len(WebDriverWait(driver, 30).until(EC.presence_of_all_elements_located((By.XPATH, "//tbody/tr")))) print(f"Found {rows_length} rows") for i in range(rows_length): row_data = [] print("Waiting for table data to load...") table_data = WebDriverWait(driver, 30).until(EC.presence_of_all_elements_located((By.XPATH, f"//tbody/tr[{i+1}]/td"))) for j in table_data: row_data.append(j.text.strip()) data.append(row_data) print(row_data) next_button = None try: print("Trying to find next button...") next_button = driver.find_element("xpath", '/html/body/app-root/div/main/div/div/app-avreg-list/nav/div/app-pagination/div/a[3]') except Exception as e: print(f"Error finding next button: {e}") break if not next_button: print("Next button not found") break try: if "disabled" in next_button.get_attribute("class"): print("Next button is disabled") break print("Clicking next button") driver.execute_script("arguments[0].click();", next_button) time.sleep(1) except Exception as e: print(f"Error clicking next button: {e}") break except Exception as e: print(f"Error: {e}") break print(f"Collected {len(data)} rows of data") df = pd.DataFrame(data) df.to_csv("CZ register.csv", index=False) driver.quit() The only way to get around this is to have ChromeDriver installed locally on my machine and change the script with the following lines:
#path_to_chromedriver = r'C:\Chromedriver\chromedriver.exe' #driver = webdriver.Chrome(service=Service(path_to_chromedriver), options=custom_options) What i want to know is if there is a way of resolving this issue without having the script point to a local version of ChromeDriver rather it silently download the matching ChromeDriver without it giving an error that there is a mismatch.

