Prefacing this with the fact that I'm fairly new to Python so apologies if I'm missing/misunderstanding something very obvious here. I have a Python script where I'm using Selenium to do some webscraping. I then hosted this on GitHub and set up an action 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 122Current 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 webdriverfrom selenium.webdriver.chrome.service import Servicefrom selenium.webdriver.common.by import Byfrom selenium.webdriver.common.keys import Keysfrom selenium.webdriver.support.ui import WebDriverWaitfrom selenium.webdriver.support import expected_conditions as ECfrom snowflake.connector import connectfrom snowflake.sqlalchemy import URLfrom snowflake.connector.pandas_tools import pd_writerfrom webdriver_manager.chrome import ChromeDriverManagerfrom webdriver_manager.core.os_manager import ChromeTypefrom selenium.webdriver.chrome.options import Optionsimport pandas as pdimport timeimport 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.txtHoping this is something silly I'm overlooking/a simple fix and that there's a dynamic solution going forward.
Thanks in advance!