Recommended Free Tools
To run a Selenium smoke test with MSTest, create a .NET test project, add Selenium WebDriver and an MSTest test runner, then write a test that opens a browser and checks a page. This guide uses Microsoft’s recommended MSTest.Sdk project setup and Selenium’s official web-form example. The two frameworks have different jobs: MSTest discovers and runs the test; Selenium drives the browser.
Choose the test project and runner first
MSTest is the test framework, while the test platform is the machinery that discovers and executes tests. Keep the project configuration consistent with the runner used by your repository, IDE, and CI. Microsoft recommends MSTest.Sdk for new MSTest projects; it uses MSTest Runner with Microsoft.Testing.Platform (MTP) by default. Microsoft also documents a package-based alternative that integrates with VSTest. These are different project patterns, so do not combine their setup instructions indiscriminately. See Microsoft’s MSTest getting-started guide and its test platform comparison.
Recommended here: MSTest.Sdk and MTP
The project below uses MSTest.Sdk, a concise MSBuild project SDK intended for MSTest projects. Microsoft’s guide illustrates version 4.1.0 targeting net10.0; treat those as documented example values, not a requirement to use those exact versions. For a new project, use a target framework and SDK supported by your installed .NET tooling, and check current package and SDK guidance if you need a specific target.
When a package-based VSTest project fits better
If your repository and tooling are already based on VSTest, use Microsoft’s package-based MSTest setup rather than grafting the SDK-style runner configuration onto it. That route uses a NuGet meta-package or its components, including the framework, adapter, analyzers, and VSTest integration. Selenium’s example project lists MSTest.TestAdapter, MSTest.TestFramework, and Microsoft.NET.Test.Sdk. The versions shown in that example are not a guarantee of the latest releases or compatibility with every combination; select compatible versions together.
#1 Best Overall
Create the project and add Selenium
Selenium’s .NET examples list .NET SDK 8.0 or later to run the test suite. This is distinct from Selenium’s file-based script instructions, which require .NET 10 or later; this tutorial creates a normal test project, not a file-based script. Install a compatible .NET SDK before starting.
-
Create a directory and a test project using the MSTest SDK template:
dotnet new mstest -n SeleniumSmoke -
Move into the project directory:
cd SeleniumSmoke -
Add Selenium WebDriver:
dotnet add package Selenium.WebDriver. The official Selenium example project also includesSelenium.Support; add it if your tests use its helpers:dotnet add package Selenium.Support. -
Restore dependencies:
dotnet restore.
For this SDK-based path, do not also add the VSTest adapter and test SDK simply because they appear in Selenium’s separate package-based sample. Follow the setup that matches the project runner you chose. Selenium’s installation instructions are at Install a Selenium library — .NET.
Free tools Windows power users keep installed
One-click scans. No signup required.
Rank #2
Write a browser smoke test
Replace the generated test file contents with the following. It uses the Selenium web form to check the page title, enter text, submit the form, and assert the response. The try/finally ensures the browser session is asked to close even if an assertion or interaction fails.
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
namespace SeleniumSmoke;
[TestClass]
public class WebFormTests
{
[TestMethod]
public void SubmittingTextShowsConfirmation()
{
IWebDriver driver = new ChromeDriver();
try
{
driver.Navigate().GoToUrl("https://www.selenium.dev/selenium/web/web-form.html");
Assert.AreEqual("Web form", driver.Title);
driver.FindElement(By.Name("my-text")).SendKeys("Selenium");
driver.FindElement(By.TagName("button")).Click();
string message = driver.FindElement(By.Id("message")).Text;
Assert.AreEqual("Received!", message);
}
finally
{
driver.Quit();
}
}
}
The test follows the official Selenium C# example’s page, selectors, title, input value, and expected confirmation. A local browser and compatible driver setup are still required; a successful package restore alone does not prove that Chrome can launch. See Selenium’s .NET usage examples for the example context.
Restore, run, and target one test
Run the project from its directory:
dotnet restore
dotnet test
To run only the method, use a fully qualified name filter. Replace the namespace or class name if you changed them:
dotnet test --filter "FullyQualifiedName~SeleniumSmoke.WebFormTests.SubmittingTextShowsConfirmation"
With a working runner, browser, and driver configuration, the test should open the form and pass when the title and submitted confirmation match the assertions. Visual Studio and Visual Studio Code are IDE options in Selenium’s .NET examples. If using an IDE or CI runner, confirm it supports the project’s selected platform, MTP, rather than assuming VSTest-specific instructions apply.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Repair Windows errors before they cause bigger problems3Scan for outdated or missing drivers - takes under a minuteBrowser setup and reliability notes
-
Browser availability:
new ChromeDriver()requests a Chrome browser session. Whether this succeeds depends on the machine’s browser and driver setup; the cited example does not guarantee a compatible local installation for every environment. -
Always clean up: keep
driver.Quit()in afinallyblock or an appropriate test lifecycle cleanup method. Otherwise, a failed assertion can leave a browser process or session open. -
Keep tests focused: a smoke test should verify a small, user-visible path. Avoid making unrelated UI behavior part of the same assertion chain, so failures point more clearly to the broken step.
-
Use platform-consistent tooling: align local IDE and CI test execution with the repository’s MTP or VSTest choice. Mixing project styles can lead to confusing discovery or execution behavior.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.Rank #4
Troubleshooting common setup failures
dotnet cannot find the template, SDK, or target framework
Check that the .NET SDK is installed and on PATH, then run dotnet --list-sdks. Use an SDK and target framework supported by the project configuration. The test-project guidance here uses the .NET SDK 8.0-or-later baseline listed by Selenium’s examples, not the separate file-based script requirement.
The test is not discovered or the runner complains
Verify that the project follows one complete runner setup: this tutorial’s MSTest.Sdk path, or a package-based VSTest path. Check that your IDE or CI supports the selected platform and that you did not combine runner dependencies from the other pattern without a reason. Re-run dotnet restore after changing project dependencies.
Chrome fails to start
A successful compile does not establish that a browser session can launch. Confirm Chrome is available in the execution environment and that the Selenium/driver setup is compatible with it. For CI or a clean machine, explicitly plan browser installation and driver management rather than relying on assumptions about a developer workstation.
The browser opens but an element cannot be found
Check that the expected page loaded and that the selectors still match its markup: my-text is the input’s name, the submit control is selected by the button tag, and the response is located by id message. If the page is still loading when Selenium searches, use an appropriate wait strategy rather than assuming every page is immediately ready.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Best Value
The test fails after an earlier failure or leaves processes behind
Ensure the driver is created inside a scope whose finally block calls Quit(). Avoid placing setup that can fail before cleanup protection is established if it creates a browser session.
Or skip the browser setup
If your goal is a page image rather than browser-driven interaction and assertions, ScreenshotNeo is a screenshot API and MCP server for developers. A single request can return an image or PDF; this is not a replacement for Selenium tests that click controls or verify application behavior.
cURL example (see the ScreenshotNeo documentation for API details):
Quick Recap
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://www.selenium.dev/selenium/web/web-form.html -o shot.webp
It removes cookie banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, and failed loads are not billed. Its MCP server lets AI agents take screenshots, and the free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000. Sign up for ScreenshotNeo’s free plan.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →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.




