Executing Selenium tests on docker image in teamcity

I need some help with integrating my Selenium tests in teamcity

I have a Selenium dotnetCore project that I execute against a docker image(standalone-chrome) and now want to Integrate it as part of teamcity.

I am able to execute the tests successfully when I try it on my local system.

However in teamcity, I get the below error:

[dotnet test] MyTestsAutoTests: MyTestsAutoTests.Tests.RegressionTestsOne.TC01_Test
[23:55:09][MyTestsAutoTests: MyTestsAutoTests.Tests.RegressionTestsOne.TC01_Test] OpenQA.Selenium.WebDriverException : An unknown exception was encountered sending an HTTP request to the remote WebDriver server for URL http://3.106.21.33:4444/wd/hub/session. The exception message was: Connection timed out ----> System.Net.Http.HttpRequestException : Connection timed out ----> System.Net.Sockets.SocketException : Connection timed out

3.106.21.33 is the public IP of the build agent I use in teamcity
I am sending the teamcity build agent public IP for the RemoteWebDriver as below as I read localhost cannot be sent in this case:
RemoteWebDriver(new Uri("http://3.106.21.33:4444/wd/hub"), chromeDockerOptions.ToCapabilities(), TimeSpan.FromMinutes(6));

Before running the tests, I have done the docker port mapping and have executed the below command:
docker run -e TZ=Australia/Sydney --shm-size=2g -id -p 4444:4444 selenium/standalone-chrome

Does anyone know why I receive the timeout error on executing the tests?

Thanks

0

Please sign in to leave a comment.