Skip to content

CI builds should be more reliable when using Chrome Driver #331

@craigfowler

Description

@craigfowler

This Claude prompt explains the issue:

I have a large number of unit tests for a project which uses .NET, Selenium and Chrome driver.
When I run the tests in CI I encounter frequent but intermittent build failures due to Chrome not starting up in a timely manner. Here's an example of a failure, but it's rarely the same tests which fail.

  Failed PerformAsAsyncShouldThrowIfWeDontWaitLongEnough(CSF.Screenplay.StageAdapter) [1 s]
  Error Message:
   System.InvalidOperationException : session not created: Chrome instance exited. Examine ChromeDriver verbose log to determine the cause. (SessionNotCreated)
  Stack Trace:
     at OpenQA.Selenium.WebDriver.UnpackAndThrowOnError(Response errorResponse, String commandToExecute)
   at OpenQA.Selenium.WebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
   at OpenQA.Selenium.WebDriver.StartSession(ICapabilities desiredCapabilities)
   at OpenQA.Selenium.WebDriver..ctor(ICommandExecutor executor, ICapabilities capabilities)
   at OpenQA.Selenium.Chromium.ChromiumDriver..ctor(ChromiumDriverService service, ChromiumOptions options, TimeSpan commandTimeout)
   at OpenQA.Selenium.Chrome.ChromeDriver..ctor(ChromeDriverService service, ChromeOptions options, TimeSpan commandTimeout)
   at OpenQA.Selenium.Chrome.ChromeDriver..ctor(ChromeOptions options)
   at InvokeStub_ChromeDriver..ctor(Object, Span`1)
   at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
1)    at OpenQA.Selenium.WebDriver.UnpackAndThrowOnError(Response errorResponse, String commandToExecute)
   at OpenQA.Selenium.WebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
   at OpenQA.Selenium.WebDriver.StartSession(ICapabilities desiredCapabilities)
   at OpenQA.Selenium.WebDriver..ctor(ICommandExecutor executor, ICapabilities capabilities)
   at OpenQA.Selenium.Chromium.ChromiumDriver..ctor(ChromiumDriverService service, ChromiumOptions options, TimeSpan commandTimeout)
   at OpenQA.Selenium.Chrome.ChromeDriver..ctor(ChromeDriverService service, ChromeOptions options, TimeSpan commandTimeout)
   at OpenQA.Selenium.Chrome.ChromeDriver..ctor(ChromeOptions options)
   at InvokeStub_ChromeDriver..ctor(Object, Span`1)
   at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
  Standard Output Messages:
 Connection refused (localhost:45651)
 Connection refused (localhost:45651)
 Connection refused (localhost:45651)
 Connection refused (localhost:45651)
 Connection refused (localhost:45651)
 Connection refused (localhost:45651)
 Connection refused (localhost:45651)

This happens in CI when running tests with GitHub actions on a Linux OS.

Are there any techniques I could use to make these more reliable?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions