.net Selenium test in CI pipeline

Hi !

I got a connection error when using CI services setup of selenium/standalone-chrome

The error messege : Error Message:

60 OpenQA.Selenium.WebDriverException : An unknown exception was encountered sending an HTTP request to the remote WebDriver server for URL http://localhost:4444/session. The exception message was: Connection refused (localhost:4444)

My .gitlab-ci.yml is like this :

tests:
stage: test
services:
- selenium/standalone-chrome:latest

script:
- ‘dotnet build’
- ‘dotnet test --no-restore’

In my dotnet project the driver i deffinde like this

IWebDriver? Driver = null;
public BlogTests()
{
    var chromeOption = new ChromeOptions();
    chromeOption.AddArguments("headless");
    Driver = new RemoteWebDriver(new Uri("http://localhost:4444"), chromeOption);  
}

If anyone successfully setup a Selenium .net test in Gitlab I like to hear about it.

/thomas, dk