To run a local Selenium browser test with MSTest, create a .NET test project, add Selenium.WebDriver from NuGet, and launch a browser with a ChromeDriver inside an MSTest test method. For a new project that can use the standard .NET SDK, Microsoft’s MSTest.Sdk is the simplest first-party setup; projects that need another base SDK can use explicit test-package references instead. The local quick-start path uses Selenium Manager for driver setup and does not require Selenium Server.
Choose an MSTest project setup
Use MSTest.Sdk for a new test project when it can be the project’s base SDK. Microsoft describes it as a first-class MSTest setup with runner and Microsoft.Testing.Platform defaults. If the project must use a different top-level SDK—such as Microsoft.NET.Sdk.Web—configure MSTest with package references instead. Confirm that the chosen packages and test runner fit the target framework and repository’s existing test infrastructure.
Option A: MSTest.Sdk for a new test project
Create a project with the .NET CLI, then edit its project file to use MSTest.Sdk as the SDK. The SDK’s version and exact project-file settings should be selected from Microsoft’s current documentation rather than copied from a stale example. Keep the MSTest runner configuration consistent with how the repository discovers and runs tests.
Option B: conventional package references
Use explicit package references when the project needs another base SDK or when the repository already follows the VSTest integration path. Selenium’s published sample uses Microsoft.NET.Test.Sdk, MSTest.TestAdapter, MSTest.TestFramework, Selenium.Support, and Selenium.WebDriver. That sample targets net8.0 and pins Microsoft.NET.Test.Sdk 17.11.1, MSTest packages 3.6.0, and Selenium packages 4.49.0; these are sample values, not a guarantee of the latest versions. See Selenium’s installation instructions and Microsoft’s MSTest introduction for current setup details.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
#1 Best Overall
Add Selenium WebDriver to the test project
Install the WebDriver package from the directory containing the test project:
dotnet add package Selenium.WebDriver
Alternatively, add a PackageReference to the project file. On the research date, NuGet surfaced Selenium.WebDriver 4.50.0 and listed support for .NET Framework 4.6.2, .NET Standard 2.0, and .NET 8.0. Selenium’s downloads page listed .NET/C# stable 4.49.0, released September 9, 2026, while its installation sample also used 4.49.0. Because those official sources did not agree on the newest version, check the Selenium.WebDriver NuGet page when setting up and avoid copying an older sample pin without verification.
Rank #2
Selenium.Support is optional for the basic Chrome launch below. Add it only if the test needs its helper APIs. If both Selenium packages are used, keep their versions aligned: the NuGet listing for Selenium.Support 4.50.0 declares a dependency on Selenium.WebDriver 4.50.0 or later. See the Selenium.Support NuGet page.
Write and run a minimal MSTest browser test
With the test project and package in place, create a test class that launches Chrome, opens a page, checks its title, and disposes the driver even if an assertion fails:
Recommended Free Tools
Rank #3
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium.Chrome;
namespace BrowserTests;
[TestClass]
public class HomePageTests
{
[TestMethod]
public void HomePageHasExpectedTitle()
{
using var driver = new ChromeDriver();
driver.Navigate().GoToUrl("https://example.com");
Assert.AreEqual("Example Domain", driver.Title);
}
}
Run the test with dotnet test from the test project’s directory. The Selenium quick-start documentation establishes the ChromeDriver launch pattern; the code above adapts that pattern to MSTest. It is an example, not a claim of a separately performed test run. Replace the example URL and expected title with a page and assertion appropriate to your application.
Understand browser and driver prerequisites
For the documented local quick start, Selenium Manager handles browser-driver installation, so manually downloading ChromeDriver is not normally a first setup step. The browser itself must still be installed and usable in the environment where the test runs. The Selenium installation and downloads pages describe this local workflow and distinguish it from remote execution: installation and downloads.
Rank #4
A local WebDriver script does not need Selenium Server. Selenium Server is for Remote WebDriver and Grid scenarios, such as remote or distributed execution; introduce it when that is the execution model you need, not merely to launch a local browser.
Check the setup when a test will not run
- The project cannot use MSTest.Sdk: Keep its required base SDK and configure MSTest manually with compatible packages and runner settings.
- NuGet reports an incompatible framework or package: Check the target framework against the package’s supported frameworks, then select versions that are available and compatible. The Selenium.WebDriver NuGet listing noted above listed .NET Framework 4.6.2, .NET Standard 2.0, and .NET 8.0; confirm current compatibility on NuGet before pinning.
- Build or restore fails after adding Selenium.Support: Align its version with Selenium.WebDriver. The documented 4.50.0 Support package requires WebDriver 4.50.0 or later.
- The test runner does not discover the test: Check whether the project uses the MSTest runner/Microsoft.Testing.Platform defaults or the VSTest path, and make its SDK, adapter, framework, and runner settings consistent.
- Browser startup fails: Confirm the browser is installed and can run in the test environment. Selenium Manager’s driver handling does not install the browser itself.
- You are trying to add Selenium Server for a local test: Remove that extra setup unless you are switching to Remote WebDriver or Grid.
Or skip the browser setup
If you need screenshots rather than interactive browser assertions, ScreenshotNeo is a website screenshot API and MCP server. One GET request returns an image or PDF; its capture flow accepts consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets, with each step configurable. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and responses identify outcomes with X-Page-Verdict and X-Billed headers. Its MCP server provides screenshot and PDF tools for AI agents. The free plan includes 1,000 screenshots a month with no card, and paid plans start at $5 for 3,000.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Here is a cURL example; replace the URL with the page you need. See the ScreenshotNeo API documentation for request options.
Best Value
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
Sign up for ScreenshotNeo’s free plan: 1,000 screenshots a month, no card required.
Frequently Asked Questions
Do I need to install Selenium Server for a local MSTest test?
No. Selenium Server is for Remote WebDriver or Grid execution; a local browser test does not require it.
Is Selenium.Support required to create a ChromeDriver?
No. The basic ChromeDriver example needs Selenium.WebDriver; add Selenium.Support only when you need its helper APIs.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Clear out junk files and repair common Windows errors3Scan for outdated or missing drivers - takes under a minuteQuick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




