GitLab's CI/CD pipelines: Selenium Chrome driver failed to start: exited abnormally or google-chrome is no longer running, Chrome has crashed

I am running git lab ci cd pipeline for selenium Python UI automated tests. My tests are passing ok on my local. I have initialized Google Chrome using below code

driver = chromedriver_autoinstaller.install()
options = webdriver.ChromeOptions()
prefs = {'profile.default_content_setting_values.automatic_downloads': 1}
options.add_experimental_option("prefs", prefs)
driver = webdriver.Chrome(options=options)

When I am running GitLab job, my pipeline is failing with below error

enter image description here

Below if the GitLab runner I can see used while running : enter image description here

I also tried to used remote driver and headless mode- In headless mode most of tests are failing. In remote mode, it not instantiating driver. Remove driver code as below

elif self.browser == 'remote':
driver = webdriver.Remote(options=webdriver.ChromeOptions(), command_executor='http://selenium__standalone-chrome:4444/wd/hub')

I am not sure if its happening due to gitlab runner. Or Do I need to create my custom gitlab runner to run on specific machine. I am running selenium UI tests , so not sure runner which is used in my case don’t have facility to run in GUI mode.

My gitlab pipeline

Thanks for taking the time to be thorough in your request, it really helps! :blush:

Any help from gitlab side?

Hi @newuserbk did you get the solution? I am also facing the same issue

The Chrome driver is trying to launch the browser in UI mode and start testing. The solution is to run the test cases with the chrome using the headless option.