I tried asking this before but it was closed as a duplicate of this post Selenium: WebDriverException:Chrome failed to start: crashed as google-chrome is no longer running so ChromeDriver is assuming that Chrome has crashed. I have tried the solutions in the post but it does work. The issue for me isn't that it doesn't work at all but the Windows Docker Image is failing to run it. I can run it on my personal machine.
I have SpecFlow tests in a c# project that I would like to get running in a GitLab job. we are doing it with a Windows Docker Image so I don't think we can uses Selenium's standalone chrome. And I have tried running it with the arguments "--headless"
and "--disable-gpu"
. the docker image should also have 2gb so adding --shm-size="2g"
doesn't seem like it will help. I'm reading that Windows Docker Images makes it difficult to support GUIs.
I have tested the Docker Image to make sure the Chrome binary is installed and is in a location that ChromeDriver could find. That has been verified as well.
the error I see is:
System.AggregateException : One or more errors occurred.
---- OpenQA.Selenium.WebDriverException : unknown error: Chrome failed to start: crashed.
(chrome not reachable)
(The process started from chrome location C:\Program Files\Google\Chrome\Application\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
---- System.NullReferenceException : Object reference not set to an instance of an object.
Edit: Here is the code used to initialize the webdriver currently. I have driver different combinations like just --headless and just the first 3
var chromeOptions = new ChromeOptions();
chromeOptions.AddArgument("--no-sandbox");
chromeOptions.AddArgument("--headless");
chromeOptions.AddArgument("--disable-dev-shm-usage");
chromeOptions.AddArgument("--disable-gpu");
_driverHelper.Driver = new ChromeDriver(chromeOptions);