Best way to wire up Selenium test automation

My team has a .NET test automation project written in C#, Selenium and nUnit.  We'd like to get some build/deployment automation around this project. We currently have the following:

1.) TeamCity running on our build server

2.) A dedicated "automation" server that can host the deployed .NET test automation project (and associated WebDriver browsers, etc.)

3.) The automation code repository hosted on our private GitHub

Conceptually, it seems like we'd need to set up a TeamCity project to build this .NET project, deploy it to our automation server and trigger it's execution (test run) via command line on the automation server.  Is this feasible with TeamCity alone?

Comment actions Permalink

Hi Brian,

I don't see anything in your setup that seems impossible. Triggering the build from a private github repository should be fine, building a .net project should work, and for deployment to remote servers, aside from sheer command line we have specific deployment tools such as scp or ftp, and for remote triggering, ssh would probably work (you can use any command line tool you consider appropriate, but ssh support is directly included).

Please, feel free to try out the professional edition, which is free, and check whether it works for your scenario.

Comment actions Permalink

I'm in the same situation and can't find solution to configure build in teamcity, I've been studying how to configure and don't find anything, someone can help with this question.

Comment actions Permalink

There are many people using selenium, and several posts throughout this forum.


The most common point of issue is that installing TeamCity agents as a service runs it on a service session, which is headless, non-interactive. The easiest way of fixing this is to simply run the agents within a user session instead of service.

Comment actions Permalink

Hi Denis. I too am trying the same thing as the initial user. Below is what I have tried


Team City and Selenium

I am trying to run a Selenium Test with Team City. Below are the parameters of the project

(a) .Net NUnit Frame. Written in Visual Studio 2017 in C#
(b) It works when I run it in Visual Studio
(c) It runs when I run it via a PowerShell command. Below is the command I used for that to happen
Invoke-Expression ("dotnet vstest SeleniumTestApp/bin/Debug/SeleniumTestApp.dll")
(d) I have tried via TeamCity a number of different process as shown below.
Eg .Net CLI -> VsTest
.Net CLI -> Test
NUnit -> NUnit 3
Visual Studio Tests -> VSTest -> VSTest 2017
Visual Studio Tests -> MSTest -> MSTest 2017

In all of the tests, TeamCity is finding the correct selenium "dll" but errors are happening.

For the ".Net CLI VSTest" and the "NUnit NUnit 3", "Visual Studio Tests -> VSTest" tests I am getting the below error
"The HTTP request to the remote WebDriver server for URL http://localhost:63855/session/lkjdslkjlkjfds/click timed out".
Where or why is this "http://localhost:63855/session" area called for? And Or do I have to find that area and replace it
with my URL?

For the .Net CLI Test I am getting the below error
"error MSB4025: The project file could not be loaded. Data at the root level is invalid. Line 1, position 1."

From my research I find it hard to find a simple demo on how to run a .Net selenium test with TeamCity.
The actual selenium tests (written in C#) are quite simple. I am also behind a proxy and so I am unsure
if that is causing an issue. I am aware of the selenium "headless" and "not headless" modes. I have run
tests in BOTH modes to check if that might be the issue.

 Any help is really appreciated. Kind regards Gunnar Weisskamp

Comment actions Permalink

Hi Gunnar,


I can only assume that the URL comes from selenium itself. I'm not too familiar with the tool, but as far as I know, it opens a webserver on localhost and then runs http connections against it from a separate process.


As it was already mentioned on this very same topic, the most common scenario is that you are running the build agent process as a service, and that usually doesn't allow to run UI tasks on it, so you'll need to run the agent's process from a user shell instead.


If that doesn't help, please follow the steps here:


Please sign in to leave a comment.