Setup Selenium Web Browser Automation using Core

There exist many kind of test: unit tests, integration tests , acceptance test, …, UI tests.
For this tutorial, we will be interested on UI tests, indeed this kind  of test, allows us to validate the IHM by launching the browser, clicking  on elements and verify the result.

So we can validate the behaviour of the application on many browsers : chrome, safari, firefox, internet explorer, etc…

We can also use a specific version of a browser : for sample  IE9

in this tutorial, we will not show how to write Selenium test in details  but we will focus on browser automation in order to execution of UI  tests on a build environnement.

So, Lets go ahead and create an core web project and a xUnit Test Project :

  • install-package Selenium.WebDriver
  • install-package Microsoft.AspNetCore.Hosting
  • install-package Microsoft.AspNetCore.TestHost
  • xunit
  • xunit.runner.visualstudio


This implementation is suitable for api tesing without opening any browser, that’s mean http://localhost:56627  cannot work in the browser,  because TestServer does not open any real network connections.

So for selenium testing I will update it using kestrel on NET Core command-line interface.

To host my project I locate the csproj folder and tell  dotnet run :

dotnet run – -project C:\TEAMPROJECT\LogCorner.BlogPost.Core\LogCorner.BlogPost.Mvc\LogCorner.BlogPost.Mvc.csproj

I no longer need  Startup class , so lets remove it





I'm a microsoft most valuable professional (MVP) .NET Architect and Technical Expert skills located in Paris (FRANCE). The purpose of this blog is mainly to post general .NET tips and tricks, Gora LEYE

Support us

BMC logoBuy me a coffee