1

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);
kevnm8337
  • 31
  • 3
  • Please [edit] your question to include the code used to initialize the web driver. – Greg Burghardt Nov 08 '21 at 18:28
  • I included where it gets created in an edit. Please let me know if that is enough – kevnm8337 Nov 08 '21 at 20:03
  • Which version of Chrome and ChromeDriver is being used in the Docker image? – Greg Burghardt Nov 08 '21 at 20:38
  • Chrome was installed using Chocolately and the ChromeDriver is currently 94.0.4606.6100. I've checked for this by installed Chrome the same way locally to verify it works. Also I've seen a different error message when it falls out of sync. I don't know the exact version of Chrome right now – kevnm8337 Nov 08 '21 at 21:12
  • You might need to set the exact path to the driver and browser. This should be done using the ChromeOptions object and a different constructor to ChromeDriver. It is just a hunch, though. I feel like the web driver and browser versions are mismatched. There might be multiple versions of Chrome installed. – Greg Burghardt Nov 08 '21 at 22:03
  • There is only one version of Chrome installed and the version mismatch was accounted for – kevnm8337 Nov 08 '21 at 22:27
  • What version of chrome is installed? The current version of chrome (which will be installed by chocolatey) is `95.0.4638.69`, so using chromedriver 94 won't work if you installed it with chocolatey recently (or are installing it as part of your CI job). The other possible reason for this kind of failure (besides the things you have already addressed) is insufficient memory (or exceeding container memory limits). – sytech Nov 09 '21 at 01:26
  • I just checked and the Chrome version is 95.0.4638.54 and I updated the ChromeDriver to match it. So it is not the Chrome version that is causing the issue. – kevnm8337 Nov 09 '21 at 16:19

0 Answers0