ChromeDriver version is falling out of sync with Chromium browser

54 Views Asked by At

I have a Python script where I'm using Selenium to do some webscraping. I then hosted this on GitHub and set up a workflow and so I'm dealing with Chromium - it ran fine for 4-5 days but started to error over the weekend where I'm guessing something updated. Upon clicking into the 'build' on GitHub Actions, I see the following error message:

selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 122
Current browser version is 121.0.6167.184 with binary path /opt/google/chrome/chrome 

What I believe to be the important parts of my code are shown below (imports and the webdriver arguments):

from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from snowflake.connector import connect
from snowflake.sqlalchemy import URL
from snowflake.connector.pandas_tools import pd_writer
from webdriver_manager.chrome import ChromeDriverManager
from webdriver_manager.core.os_manager import ChromeType
from selenium.webdriver.chrome.options import Options
import pandas as pd
import time
import os

...

chrome_options = Options()
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--headless')
chrome_options.add_argument('--disable-dev-shm-usage')
driver_path = Service(ChromeDriverManager(chrome_type=ChromeType.CHROMIUM).install())
driver = webdriver.Chrome(service=driver_path, options=chrome_options)

I found a couple of similar topics and tried some of these fixes such as: Selenium Error: Which webdrivermanager version supports chrome version 121?

However, I think I'm using a different Webdrivermanager? https://pypi.org/project/webdriver-manager/, as the current version of this is 4.0.1 and I therefore can't upgrade to version 5.x.x.

I also can't manually conduct downloads as this is a GitHub action and therefore spins up on a remote Linux machine. The part of my actions.yml file that handles that is as follows in case that's important:

      - name: set up environment
        run: |
          sudo apt-get update
          sudo apt-get install -y chromium-browser
          python -m pip install --upgrade pip
          pip install -r requirements.txt
0

There are 0 best solutions below