Search code examples
c#seleniumgoogle-chromeselenium-chromedrivercodefresh

OpenQA.Selenium.WebDriverException : unknown error: Chrome failed to start: exited abnormally on CodeFresh


While running smoke tests in CodeFresh we occasionally get this error

[xUnit.net 00:02:41.43]       OpenQA.Selenium.WebDriverException : unknown error: Chrome failed to start: exited abnormally.
[xUnit.net 00:02:41.43]         (unknown error: DevToolsActivePort file doesn't exist)
[xUnit.net 00:02:41.43]         (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
[xUnit.net 00:02:41.43]       Stack Trace:
[xUnit.net 00:02:41.43]            at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
[xUnit.net 00:02:41.43]            at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
[xUnit.net 00:02:41.43]            at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities)
[xUnit.net 00:02:41.43]            at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities)
[xUnit.net 00:02:41.43]            at OpenQA.Selenium.Chrome.ChromeDriver..ctor(ChromeDriverService service, ChromeOptions options, TimeSpan commandTimeout)
[xUnit.net 00:02:41.43]            at OpenQA.Selenium.Chrome.ChromeDriver..ctor(ChromeOptions options)
[xUnit.net 00:02:41.43]         /src/Features/Helpers/Hooks.cs(32,0): at Live_Automation.Features.Helpers.Hooks.BeforeScenario()
[xUnit.net 00:02:41.43]            at TechTalk.SpecFlow.Bindings.BindingInvoker.InvokeBinding(IBinding binding, IContextManager contextManager, Object[] arguments, ITestTracer testTracer, TimeSpan& duration)
[xUnit.net 00:02:41.43]            at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.InvokeHook(IBindingInvoker invoker, IHookBinding hookBinding, HookType hookType)
[xUnit.net 00:02:41.43]            at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.FireEvents(HookType hookType)
[xUnit.net 00:02:41.43]            at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnScenarioStart()
[xUnit.net 00:02:41.43]            at TechTalk.SpecFlow.TestRunner.OnScenarioStart()
[xUnit.net 00:02:41.43]            at Live_Automation.Features.SmokeTestsOnLiveFeature.ScenarioStart()

This happens on average 1 test run in 10 and often it is just one scenario as below

Test Run Failed.
Total tests: 52
     Passed: 51
     Failed: 1

The failing test is random as is the time of day this may happen. The test suite is built around Visual Studio/C#/Selenium/Xunit

On an either rarer occasion we get this

[xUnit.net 00:03:26.88]       OpenQA.Selenium.WebDriverException : unknown error: session deleted because of page crash
[xUnit.net 00:03:26.88]       from unknown error: cannot determine loading status
[xUnit.net 00:03:26.88]       from tab crashed
[xUnit.net 00:03:26.88]         (Session info: headless chrome=87.0.4280.141)
[xUnit.net 00:03:26.88]       Stack Trace:
[xUnit.net 00:03:26.88]            at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
[xUnit.net 00:03:26.88]            at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
[xUnit.net 00:03:26.88]            at OpenQA.Selenium.Remote.RemoteWebDriver.set_Url(String value)
[xUnit.net 00:03:26.88]            at OpenQA.Selenium.Remote.RemoteNavigator.GoToUrl(String url)
[xUnit.net 00:03:26.88]         /src/Features/Pages/HomePage.cs(61,0): at Live_Automation.Features.Pages.HomePage.Visit()
[xUnit.net 00:03:26.88]            at TechTalk.SpecFlow.Bindings.BindingInvoker.InvokeBinding(IBinding binding, IContextManager contextManager, Object[] arguments, ITestTracer testTracer, TimeSpan& duration)
[xUnit.net 00:03:26.88]            at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.ExecuteStepMatch(BindingMatch match, Object[] arguments)
[xUnit.net 00:03:26.88]            at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.ExecuteStep(IContextManager contextManager, StepInstance stepInstance)
[xUnit.net 00:03:26.88]            at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnAfterLastStep()
[xUnit.net 00:03:26.88]            at TechTalk.SpecFlow.TestRunner.CollectScenarioErrors()
[xUnit.net 00:03:26.88]            at Live_Automation.Features.SmokeTestsOnLiveFeature.ScenarioCleanup()
[xUnit.net 00:03:26.88]         /src/Features/SmokeTests.feature(80,0): at Live_Automation.Features.SmokeTestsOnLiveFeature.TestFooterOptions(String footer, String url, String[] exampleTags)

Now when this happens all scenarios from this point will fail Has anyone got any ideas please about what is causing this. I do not think it is the tests.

Thanks in advance

Kev


Solution

  • I have resolved this issue. Since adding this line there have been no problems.

    options.AddArguments("--disable-dev-shm-usage");