webdriver_manager
webdriver_manager copied to clipboard
WebDriverException: Service chromedriver unexpectedly exited. Status code was: -5
I'm trying to run chrome within AWS MWAA but the webdriver exits each time with status code -5.
Grab the image from https://github.com/aws/aws-mwaa-local-runner and run it
Once the container is running you can bash into it, install selenium and the webdriver-manager and run the following script.
from selenium import webdriver
from selenium.webdriver.chrome.service import Service as ChromiumService
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from webdriver_manager.chrome import ChromeDriverManager
from webdriver_manager.core.os_manager import ChromeType
from selenium.webdriver.chrome.options import Options
options = Options()
options.add_argument("--headless=new")
driver = webdriver.Chrome(
service=ChromiumService(
ChromeDriverManager(chrome_type=ChromeType.CHROMIUM).install()
),
options=options,
)
Error log
>>> options = Options()
>>> options.add_argument("--headless=new")
>>> driver = webdriver.Chrome(
... service=ChromiumService(
... ChromeDriverManager(chrome_type=ChromeType.CHROMIUM).install()
... ),
... options=options,
... )
DEBUG:selenium.webdriver.common.driver_finder:Skipping Selenium Manager; path to chrome driver specified in Service class: /usr/local/airflow/.wdm/drivers/chromedriver/linux64/114.0.5735.90/chromedriver
DEBUG:selenium.webdriver.common.service:Started executable: `/usr/local/airflow/.wdm/drivers/chromedriver/linux64/114.0.5735.90/chromedriver` in a child process with pid: 19414 using 0 to output -3
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/airflow/.local/lib/python3.11/site-packages/selenium/webdriver/chrome/webdriver.py", line 45, in __init__
super().__init__(
File "/usr/local/airflow/.local/lib/python3.11/site-packages/selenium/webdriver/chromium/webdriver.py", line 55, in __init__
self.service.start()
File "/usr/local/airflow/.local/lib/python3.11/site-packages/selenium/webdriver/common/service.py", line 102, in start
self.assert_process_still_running()
File "/usr/local/airflow/.local/lib/python3.11/site-packages/selenium/webdriver/common/service.py", line 115, in assert_process_still_running
raise WebDriverException(f"Service {self._path} unexpectedly exited. Status code was: {return_code}")
selenium.common.exceptions.WebDriverException: Message: Service /usr/local/airflow/.wdm/drivers/chromedriver/linux64/114.0.5735.90/chromedriver unexpectedly exited. Status code was: -5
>>>
>>>
Having the same issue, just with Chrome instead of Chromium.
Same issue. Works locally but fails in a containerized environment.