I am running a Docker image, I am getting the following error.
session not created: This version of ChromeDriver only supports Chrome version 114
Current browser version is 116.0.5845.96
with binary path /usr/bin/google-chrome
The Dockerfile that has the chrome installation is as below:
# Base image
FROM python:3.9
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
COPY . /app
COPY wait-for-it.sh /
COPY docker-entrypoint.sh /
WORKDIR /app
RUN pip install --upgrade pip
RUN pip install -r requirements.txt
# Install system dependencies
RUN apt-get update && apt-get install -y supervisor
RUN apt-get update && apt-get install -y supervisor curl unzip
# Install Chromium
RUN curl -sSL https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -o /chrome.deb
RUN dpkg -i /chrome.deb || apt-get install -fy
# Install ChromeDriver
RUN LATEST_VERSION=$(curl -sSL https://chromedriver.storage.googleapis.com/LATEST_RELEASE) && \
curl -sSL https://chromedriver.storage.googleapis.com/$LATEST_VERSION/chromedriver_linux64.zip -o /chromedriver.zip && \
unzip /chromedriver.zip -d /usr/bin && \
chmod +x /usr/bin/chromedriver && \
rm /chromedriver.zip
# Copy the supervisor configuration files
COPY _config/supervisor/django.conf /etc/supervisor/conf.d/
COPY _config/supervisor/celery.conf /etc/supervisor/conf.d/
EXPOSE 8000
RUN chmod +x /wait-for-it.sh /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]
My selenium python test class is below:
def connect_selenium():
"""
Description: Connect to Selenium
"""
options = webdriver.ChromeOptions()
options.add_argument('--no-sandbox')
options.add_argument('--disable-dev-shm-usage')
options.add_argument('--headless') # Add this line to run Chrome in headless mode
options.add_argument('--disable-gpu')
options.add_argument('--window-size=1920,1080')
driver = webdriver.Chrome('/usr/bin/chromedriver', options=options)
return driver
Any help is much appreciated.