Skip to content

[🐛 Bug]: Issue with SergeyPirogov/webdriver_manager#687 #14750

@jackpeikun

Description

@jackpeikun

What happened?

Background

I am trying to setup a docker image so I can run my python application anywhere

DockerFile

FROM python:3.12-slim

# Set the working directory in the container
WORKDIR /app

# Copy only requirements.txt first to take advantage of Docker's cache
COPY requirements.txt /app/

# Install any necessary dependencies
RUN pip install --no-cache-dir -r requirements.txt

# Copy the rest of the application files into the container
COPY . /app

# Create the logs directory
RUN mkdir -p /app/logs

# Set the environment variable to not buffer Python output
ENV PYTHONUNBUFFERED=1

# Run the application (adjust the command based on your app's entry point)
CMD ["python", "main.py"]

My requirements.txt

boto3~=1.35.58
requests~=2.32.3
cachetools~=5.5.0
selenium~=4.25.0
webdriver-manager
python-dotenv~=1.0.1

How I start my Driver

    options = Options()
    options.add_argument('--headless=new')
    options.add_argument(f'user-agent={TEST_HEADER.get("User-Agent")}')  # necessary when the website has javascript
    options.add_argument('--disable-gpu')
    options.add_argument('--no-sandbox')  # Important for running in Docker
    options.add_argument('--verbose')

    driver = webdriver.Chrome(service=ChromeService(ChromeDriverManager().install()), options=options)

Error log from docker

2024-11-12 11:18:27 ====== WebDriver manager ======
2024-11-12 11:18:27 Get LATEST chromedriver version for google-chrome
2024-11-12 11:18:27 About to download new driver from https://chromedriver.storage.googleapis.com/114.0.5735.90/chromedriver_linux64.zip
2024-11-12 11:18:28 Driver downloading response is 200
2024-11-12 11:18:28 Get LATEST chromedriver version for google-chrome
2024-11-12 11:18:28 Get LATEST chromedriver version for google-chrome
2024-11-12 11:18:28 Driver has been saved in cache [/root/.wdm/drivers/chromedriver/linux64/114.0.5735.90]
2024-11-12 11:18:28 Error during loading or interaction: Message: Service /root/.wdm/drivers/chromedriver/linux64/114.0.5735.90/chromedriver unexpectedly exited. Status code was: -5
2024-11-12 11:18:28  Traceback (most recent call last):
2024-11-12 11:18:28   File "/app/main.py", line 296, in <module>
2024-11-12 11:18:28     driver, session = create_new_driver_and_session(cache)
2024-11-12 11:18:28                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-12 11:18:28   File "/app/main.py", line 131, in create_new_driver_and_session
2024-11-12 11:18:28     new_webdriver = login_and_return_driver()
2024-11-12 11:18:28                     ^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-12 11:18:28   File "/app/main.py", line 168, in login_and_return_driver
2024-11-12 11:18:28     driver = webdriver.Chrome(service=ChromeService(ChromeDriverManager().install()), options=options)
2024-11-12 11:18:28              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-12 11:18:28   File "/usr/local/lib/python3.12/site-packages/selenium/webdriver/chrome/webdriver.py", line 45, in __init__
2024-11-12 11:18:28     super().__init__(
2024-11-12 11:18:28   File "/usr/local/lib/python3.12/site-packages/selenium/webdriver/chromium/webdriver.py", line 55, in __init__
2024-11-12 11:18:28     self.service.start()
2024-11-12 11:18:28   File "/usr/local/lib/python3.12/site-packages/selenium/webdriver/common/service.py", line 105, in start
2024-11-12 11:18:28     self.assert_process_still_running()
2024-11-12 11:18:28   File "/usr/local/lib/python3.12/site-packages/selenium/webdriver/common/service.py", line 118, in assert_process_still_running
2024-11-12 11:18:28     raise WebDriverException(f"Service {self._path} unexpectedly exited. Status code was: {return_code}")
2024-11-12 11:18:28 selenium.common.exceptions.WebDriverException: Message: Service /root/.wdm/drivers/chromedriver/linux64/114.0.5735.90/chromedriver unexpectedly exited. Status code was: -5

How can we reproduce the issue?

basically setup the same docker and file and you should be able to re-produce it

Relevant log output

2024-11-12 11:18:27 ====== WebDriver manager ======
2024-11-12 11:18:27 Get LATEST chromedriver version for google-chrome
2024-11-12 11:18:27 About to download new driver from https://chromedriver.storage.googleapis.com/114.0.5735.90/chromedriver_linux64.zip
2024-11-12 11:18:28 Driver downloading response is 200
2024-11-12 11:18:28 Get LATEST chromedriver version for google-chrome
2024-11-12 11:18:28 Get LATEST chromedriver version for google-chrome
2024-11-12 11:18:28 Driver has been saved in cache [/root/.wdm/drivers/chromedriver/linux64/114.0.5735.90]
2024-11-12 11:18:28 Error during loading or interaction: Message: Service /root/.wdm/drivers/chromedriver/linux64/114.0.5735.90/chromedriver unexpectedly exited. Status code was: -5
2024-11-12 11:18:28  Traceback (most recent call last):
2024-11-12 11:18:28   File "/app/main.py", line 296, in <module>
2024-11-12 11:18:28     driver, session = create_new_driver_and_session(cache)
2024-11-12 11:18:28                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-12 11:18:28   File "/app/main.py", line 131, in create_new_driver_and_session
2024-11-12 11:18:28     new_webdriver = login_and_return_driver()
2024-11-12 11:18:28                     ^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-12 11:18:28   File "/app/main.py", line 168, in login_and_return_driver
2024-11-12 11:18:28     driver = webdriver.Chrome(service=ChromeService(ChromeDriverManager().install()), options=options)
2024-11-12 11:18:28              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-12 11:18:28   File "/usr/local/lib/python3.12/site-packages/selenium/webdriver/chrome/webdriver.py", line 45, in __init__
2024-11-12 11:18:28     super().__init__(
2024-11-12 11:18:28   File "/usr/local/lib/python3.12/site-packages/selenium/webdriver/chromium/webdriver.py", line 55, in __init__
2024-11-12 11:18:28     self.service.start()
2024-11-12 11:18:28   File "/usr/local/lib/python3.12/site-packages/selenium/webdriver/common/service.py", line 105, in start
2024-11-12 11:18:28     self.assert_process_still_running()
2024-11-12 11:18:28   File "/usr/local/lib/python3.12/site-packages/selenium/webdriver/common/service.py", line 118, in assert_process_still_running
2024-11-12 11:18:28     raise WebDriverException(f"Service {self._path} unexpectedly exited. Status code was: {return_code}")
2024-11-12 11:18:28 selenium.common.exceptions.WebDriverException: Message: Service /root/.wdm/drivers/chromedriver/linux64/114.0.5735.90/chromedriver unexpectedly exited. Status code was: -5

Operating System

Running docker on MacOS 15.1

Selenium version

4.25.0

What are the browser(s) and version(s) where you see this issue?

Chrome

What are the browser driver(s) and version(s) where you see this issue?

chromedriver/linux64/114.0.5735.90/chromedrive

Are you using Selenium Grid?

No

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-questionApplied to questions. Issues should be closed and send the user to community resources.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions