To run Selenium browser tests with MSTest, create a .NET test project, add Selenium.WebDriver from NuGet, and write an MSTest test that creates and disposes a ChromeDriver. For a new project that can use it as its base SDK, Microsoft recommends MSTest.Sdk; projects that need a different base SDK can use conventional MSTest package references instead. Selenium Manager handles driver setup in the documented quick start, so you normally do not start by downloading ChromeDriver yourself.
Choose an MSTest project setup
There are two common starting points. Choose based on the SDK and test-runner approach your project needs; keep the package configuration consistent with that choice.
| Approach | Use it when | Configuration note |
|---|---|---|
MSTest.Sdk |
You are creating a new MSTest project and can use Microsoft.NET.Sdk as the project’s base SDK. |
Microsoft recommends this first-party project SDK for a simple MSTest setup. It provides MSTest runner/Microsoft.Testing.Platform defaults. See Microsoft’s MSTest introduction and MSTest project configuration guidance. |
| Conventional package references | Your project needs a different top-level SDK, such as Microsoft.NET.Sdk.Web, or your repository already uses the VSTest integration path. |
Reference the required test SDK, MSTest framework and adapter packages in the project file. Follow Microsoft’s guidance for the runner you use rather than mixing runner settings casually. |
The MSTest.Sdk option is not a fit when another SDK must remain the project’s base. In that case, manual package configuration lets you keep that SDK while adding MSTest dependencies.
Create the test project and add Selenium
Start with a new MSTest project
In Visual Studio, create a new project using the MSTest Test Project template, then choose the target framework appropriate for your environment. If you are creating the project with the .NET CLI, use the MSTest template available in your installed SDK; template availability and options can vary by SDK version.
#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
Add the WebDriver NuGet package
From the directory containing the test project, run:
dotnet add package Selenium.WebDriver
NuGet’s Selenium.WebDriver page also provides a PackageReference option for adding the dependency in the project file. At the time reflected by the reviewed package listing, NuGet surfaced version 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, and its sample project used 4.49.0. These official pages did not agree on the newest version, so check NuGet’s Selenium.WebDriver page when you install rather than assuming an older sample pin is current. The version listings are volatile.
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
Selenium’s conventional sample project targets net8.0 and pins Microsoft.NET.Test.Sdk 17.11.1, MSTest.TestAdapter 3.6.0, MSTest.TestFramework 3.6.0, and Selenium WebDriver and Support 4.49.0. Those are sample values, not a guarantee that they are the latest compatible versions. See Selenium’s .NET installation guidance.
When to add Selenium.Support
Selenium.Support is optional for the basic ChromeDriver example below. Add it if your tests use its helper APIs. If you reference it, keep its version aligned with Selenium.WebDriver: the reviewed NuGet listing for Selenium.Support 4.50.0 declares a dependency on Selenium.WebDriver 4.50.0 or later. Check the package listing for the version you select at NuGet’s Selenium.Support page.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Rank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
Write and run a minimal MSTest browser test
Add a test class to the project. This example opens a page in Chrome, checks its title, and disposes the driver even if an assertion fails:
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium.Chrome;
namespace BrowserTests;
[TestClass]
public class BrowserTitleTests
{
[TestMethod]
public void OpensExamplePageAndReadsTitle()
{
using var driver = new ChromeDriver();
driver.Navigate().GoToUrl("https://example.com");
Assert.AreEqual("Example Domain", driver.Title);
}
}
Run the test from Visual Studio Test Explorer or, from the project directory, with:
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
dotnet test
The Selenium quick start documents this driver-creation pattern. The test assumes a usable Chrome browser is installed in the environment where it runs. The cited setup instructions establish the launch shape; they do not constitute a claim that this particular example was independently executed.
Understand browser and driver setup
For Selenium’s documented quick start, Selenium Manager handles browser-driver installation. A separate manual ChromeDriver download is therefore not normally the first setup step. The browser itself still needs to be present and usable in the test environment. If the driver cannot locate or start the browser, check the browser installation and the execution environment before adding manual driver-management steps.
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 minuteBest Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
A local WebDriver test does not require Selenium Server. Selenium Server is for Remote WebDriver/Grid use, including remote or distributed execution. Introduce Grid when tests need to run against remote browser nodes, not just to launch a local browser. See the Selenium installation guidance and Selenium downloads page.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Conventional project-file example
If you choose manual package references, Selenium’s published sample uses this shape. It targets net8.0; the versions below are the sample’s pins and should be checked against current NuGet and Microsoft guidance before use.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="MSTest.TestAdapter" Version="3.6.0" />
<PackageReference Include="MSTest.TestFramework" Version="3.6.0" />
<PackageReference Include="Selenium.Support" Version="4.49.0" />
<PackageReference Include="Selenium.WebDriver" Version="4.49.0" />
</ItemGroup>
</Project>
For a project based on MSTest.Sdk, use Microsoft’s current project-configuration instructions instead of layering this conventional VSTest-style sample on top without checking which runner your project uses. Similarly, if you retain a different base SDK, configure MSTest manually according to the project’s runner path.
Troubleshoot common setup failures
The test project cannot resolve Selenium types
- Confirm that
Selenium.WebDriveris installed in the test project, not only another project in the solution. - Restore packages with
dotnet restore, then build again. - Check that the source file imports
OpenQA.Selenium.Chromeand that the target framework is supported by the package version you selected.
The browser fails to start or the driver is not found
- Confirm that Chrome is installed and usable by the account running the test.
- Allow Selenium Manager to perform its documented driver setup; a manual driver download is not normally needed for the initial local quick start.
- If running in a restricted environment, inspect its access to the browser and driver resources before changing project dependencies. Remote execution is a separate configuration that may require Selenium Server/Grid.
The test is not discovered or the runner behaves unexpectedly
- Verify the project uses one consistent MSTest configuration: either the
MSTest.Sdkpath where it can be the base SDK, or manual packages appropriate to the project’s SDK and runner. - Check that the MSTest framework, adapter, and test SDK versions are compatible with the chosen .NET target and runner path.
- Use Microsoft’s current MSTest configuration documentation for runner settings rather than mixing defaults from MSTest runner/Microsoft.Testing.Platform and VSTest setups.
NuGet reports package or framework incompatibility
- Check the package’s supported target frameworks on its current NuGet page.
- When using both Selenium packages, align Selenium.Support and Selenium.WebDriver versions.
- Do not assume the sample’s Selenium 4.49.0 pin is newest: the reviewed NuGet listing surfaced 4.50.0 while Selenium’s downloads page listed 4.49.0.
Or skip the browser setup
If the goal is to capture a page image or PDF rather than run an interactive MSTest browser workflow, ScreenshotNeo provides a website screenshot API and MCP server for developers. One GET request can return a screenshot or PDF, without setting up Selenium for that capture.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Quick Recap
cURL:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp
See the ScreenshotNeo API documentation for request options and response details. It removes cookie banners, newsletter popups and chat widgets before the shot; bot checks, blank pages and failed loads are never billed; its MCP server lets AI agents take screenshots; and the free plan includes 1,000 screenshots a month with no card, with paid plans starting at $5 for 3,000. Sign up for free.
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.

