I am trying to run my UI automation tests in a docker. Below are some relevant details:-
Docker Image:-"python:3.10"
Below is my gitlab-ci file which actually installs required stuff:- before_script:
- wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
- echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list
- apt-get update
- apt-get install -y google-chrome-stable
- apt-get update -q -y
- apt-get install -y python3-pip
- apt-get install libnss3
- python -V
- pip3 install -r requirements.text
I am using webdriver_manager to install drivers
def set_options_for_chrome(context):
options = webdriver.ChromeOptions()
options.add_argument("window-size=1600,1440")
options.add_argument('--no-sandbox')
options.add_argument('--disable-dev-shm-usage')
options.add_argument('--remote-debugging-port=9222')
options.add_argument('--crash-dumps-dir=/tmp')
options.headless = context.headless
options.binary_location = ChromeDriverManager().install()
return options
context.driver= webdriver.Chrome(options=set_options_for_chrome(context))
The above code installs the chrome driver at below location: /root/.wdm/drivers/chromedriver/linux64/112.0.5615.49/chromedriver (so the downloading part looks fine to me)
Error:- WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally. (unknown error: DevToolsActivePort file doesn't exist) (The process started from chrome location /root/.wdm/drivers/chromedriver/linux64/112.0.5615.49/chromedriver is no longer running, so ChromeDriver is assuming that Chrome has crashed.)