---
title: 'Selenium C# Tutorial with NUnit: Free Online Course'
description: 'A free Selenium C# tutorial on .NET 10 and NUnit: project setup with
  Selenium Manager, locators, WebDriverWait, [TestCase] data, constraint assertions,
  page objects, parallel runs, a cloud grid and CI.'
source_url:
  html: https://testingbot.com/resources/courses/selenium-csharp
  md: https://testingbot.com/resources/courses/selenium-csharp.md
---

Course

[Selenium C# Tutorial with NUnit](https://testingbot.com/resources/courses/selenium-csharp)

Chapter 1 of 10

1. [1 Selenium C# Tutorial with NUnit](https://testingbot.com/resources/courses/selenium-csharp)
2. [2 Set up .NET, Selenium and NUnit](https://testingbot.com/resources/courses/selenium-csharp/setup-and-first-test)
3. [3 Selenium C# locators and WebDriverWait](https://testingbot.com/resources/courses/selenium-csharp/locators-and-waits)
4. [4 NUnit fixtures, attributes and [TestCase] ](https://testingbot.com/resources/courses/selenium-csharp/nunit-fixtures-and-attributes)
5. [5 NUnit assertions and screenshots on failure](https://testingbot.com/resources/courses/selenium-csharp/assertions-and-screenshots)
6. [6 Page objects in C#](https://testingbot.com/resources/courses/selenium-csharp/page-objects)
7. [7 Run Selenium C# tests on the TestingBot grid](https://testingbot.com/resources/courses/selenium-csharp/run-on-testingbot)
8. [8 Parallel Selenium tests with NUnit](https://testingbot.com/resources/courses/selenium-csharp/parallel-tests)
9. [9 Selenium C# tests in CI](https://testingbot.com/resources/courses/selenium-csharp/ci-with-github-actions)
10. [10 Selenium C# Quiz](https://testingbot.com/resources/courses/selenium-csharp/knowledge-check)

[Exit course](https://testingbot.com/resources/courses)

 Chapter 1 of 10 Intermediate 5 min read Updated Nov 2026 

# Selenium C# Tutorial with NUnit

A free Selenium C# tutorial on .NET 10 and NUnit: project setup with Selenium Manager, locators, WebDriverWait, [TestCase] data, constraint assertions, page objects, parallel runs, a cloud grid and CI.

## What you will learn

1. Selenium C# Tutorial with NUnit
2. [Set up .NET, Selenium and NUnit](https://testingbot.com/resources/courses/selenium-csharp/setup-and-first-test)
3. [Selenium C# locators and WebDriverWait](https://testingbot.com/resources/courses/selenium-csharp/locators-and-waits)
4. [NUnit fixtures, attributes and [TestCase]](https://testingbot.com/resources/courses/selenium-csharp/nunit-fixtures-and-attributes)
5. [NUnit assertions and screenshots on failure](https://testingbot.com/resources/courses/selenium-csharp/assertions-and-screenshots)
6. [Page objects in C#](https://testingbot.com/resources/courses/selenium-csharp/page-objects)
7. [Run Selenium C# tests on the TestingBot grid](https://testingbot.com/resources/courses/selenium-csharp/run-on-testingbot)
8. [Parallel Selenium tests with NUnit](https://testingbot.com/resources/courses/selenium-csharp/parallel-tests)
9. [Selenium C# tests in CI](https://testingbot.com/resources/courses/selenium-csharp/ci-with-github-actions)
10. [Selenium C# Quiz](https://testingbot.com/resources/courses/selenium-csharp/knowledge-check)

[Continue where you left off](https://testingbot.com#)

## TestingBot Selenium C# Certification

Turn this course into a free, resume-worthy credential: pass the exam, run the course suite on TestingBot, and get a verifiable certificate for your LinkedIn profile.

[How it works](https://testingbot.com/resources/courses/selenium-csharp/certification)On this page
1. [Selenium drives the browser, NUnit runs the tests](https://testingbot.com#selenium-drives-the-browser-nunit-runs-the-tests)
2. [Why NUnit?](https://testingbot.com#why-nunit)
3. [What you'll build](https://testingbot.com#what-you-ll-build)
4. [Prerequisites](https://testingbot.com#prerequisites)

_Last reviewed November 2026 against Selenium.WebDriver 4.52.0, NUnit 5.0.0, NUnit3TestAdapter 6.3.1, Microsoft.NET.Test.Sdk 18.12.0 and the .NET 10 SDK (10.0.404)._

This course builds a small but complete browser test suite in C#. Every example in it was compiled and run, first against local Chrome and Firefox and then, in chapter 6, on the TestingBot grid. By the end you have one project that runs on your laptop, in CI and on a cloud grid without changing a single test.

## Selenium drives the browser, NUnit runs the tests[#](https://testingbot.com#selenium-drives-the-browser-nunit-runs-the-tests)

The suite is built from two libraries that do very different jobs. Most early confusion comes from mixing them up.

**Selenium WebDriver** is a browser automation library. It starts a browser, navigates, finds elements, clicks, types and reads text back. It has no idea what a test is: it does not know what "passed" means, and it leaves a browser running forever if nobody calls `Quit()`.

**NUnit** is a test framework. It finds methods marked `[Test]`, runs `[SetUp]` and `[TearDown]` code around them, feeds them data with `[TestCase]`, checks results with `Assert.That`, runs tests in parallel and reports what passed and failed. It knows nothing about browsers. The `dotnet test` command, through the NUnit test adapter, is what discovers and runs the tests.

| Concern | Who handles it |
| --- | --- |
| Start and stop a browser | Selenium (`new ChromeDriver()`, `driver.Quit()`), called from NUnit's `[SetUp]` and `[TearDown]` |
| Find elements, wait for them, interact | Selenium (`By`, `WebDriverWait`, `SelectElement`) |
| Discover, filter and run tests | NUnit and `dotnet test` (`[Test]`, `--filter`, `[Category]`) |
| Check results | NUnit (`Assert.That` with constraints) |
| Run one test with several inputs | NUnit (`[TestCase]`, `[TestCaseSource]`) |
| Run tests in parallel | NUnit (`[Parallelizable]`); each test still needs its own browser |
| Screenshots on failure | NUnit's `TearDown` and `TestContext`, using Selenium to take the screenshot |

Here is the whole idea in one class:

```csharp
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;

public class FirstTest
{
    private IWebDriver driver = null!;

    [SetUp]
    public void StartBrowser() => driver = new ChromeDriver(); // Selenium

    [Test] // NUnit
    public void WebFormHasTheRightTitle()
    {
        driver.Navigate().GoToUrl("https://www.selenium.dev/selenium/web/web-form.html");
        Assert.That(driver.Title, Is.EqualTo("Web form")); // NUnit
    }

    [TearDown]
    public void StopBrowser() => driver.Quit(); // runs pass or fail
}
```

Nothing here downloads a ChromeDriver binary. Since Selenium 4.6, **Selenium Manager** ships inside the `Selenium.WebDriver` package and finds or downloads the right driver the first time you start a browser. Tutorials that start with "install the Selenium.WebDriver.ChromeDriver package" or "download chromedriver.exe" are out of date.

## Why NUnit?[#](https://testingbot.com#why-nunit)

.NET has three widely used test frameworks, and Selenium works with all of them. This course uses NUnit because it has the most to offer a browser suite out of the box:

- **Setup and teardown at every level** : per test, per fixture class, per namespace and per assembly.
- **Parameterised tests** with `[TestCase]` and `[TestCaseSource]`, so one method covers many inputs.
- **Fine-grained parallelism** with `[Parallelizable]` and `[FixtureLifeCycle]`, which chapter 7 depends on.
- **The constraint model** , `Assert.That(actual, Is.EqualTo(expected))`, which reads well and fails with useful messages.

If your team already uses MSTest or xUnit, the Selenium code in this course carries over unchanged; only the attributes differ. TestingBot has examples for [MSTest](https://testingbot.com/support/web-automate/selenium/csharp/mstest), [xUnit](https://testingbot.com/support/web-automate/selenium/csharp/xunit), and for behaviour-driven tests with [Reqnroll](https://testingbot.com/support/web-automate/selenium/csharp/reqnroll), the successor of SpecFlow.

## What you'll build[#](https://testingbot.com#what-you-ll-build)

| Chapter | You add |
| --- | --- |
| 1. Set up .NET, Selenium and NUnit | a test project, Selenium Manager, a first passing test |
| 2. Locators and waits | the `By` strategies and `WebDriverWait` with lambdas, instead of `Thread.Sleep` |
| 3. NUnit fixtures and attributes | a `BaseTest` class, a driver factory, `[TestCase]` data, categories |
| 4. Assertions and screenshots | the constraint model, multiple-assert scopes, a screenshot for every failure |
| 5. Page objects | two small page objects with fluent methods |
| 6. The TestingBot grid | `RemoteWebDriver`, `tb:options`, pass/fail status on the grid |
| 7. Parallel runs | `[Parallelizable]`, one fixture instance per test, worker counts |
| 8. CI | a GitHub Actions workflow with TRX results, and the Azure Pipelines equivalent |
| 9. Quiz | ten questions on the decisions the course made |

The final project looks like this:

```
SeleniumCourse/
  SeleniumCourse.csproj package references
  .editorconfig one analyzer setting
  Parallelism.cs assembly-level parallel settings
  Support/
    DriverFactory.cs local or remote browser, from environment variables
    BaseTest.cs SetUp/TearDown, screenshots, grid status
  Pages/
    WebFormPage.cs
    SubmittedPage.cs
  Tests/
    LocatorTests.cs
    WaitTests.cs
    WebFormTests.cs
```

The tests use the practice pages the Selenium project publishes for this purpose: a [web form](https://www.selenium.dev/selenium/web/web-form.html) and a page that adds elements after a delay. They are public, stable and safe to hit from a test.

## Prerequisites[#](https://testingbot.com#prerequisites)

- **The .NET SDK.** The examples use .NET 10, the current long-term support release; NUnit 5 runs on .NET 8 and later, so a .NET 8 SDK works too if you change the target framework.
- Basic C#: classes, properties, lambdas.
- Chrome installed locally (Firefox too, for the cross-browser parts).
- No prior Selenium experience.

Sibling courses build the same suite in other languages: [Selenium with Python and pytest](https://testingbot.com/resources/courses/selenium-python) and [Selenium with Java and TestNG](https://testingbot.com/resources/courses/selenium-testng). And a common question up front: the Selenium project does not offer an official certification. What employers look for is a suite you can explain, which is what this course builds; TestingBot's own course certificate, if you want one, is described at the end.

[Next · Chapter 2 Set up .NET, Selenium and NUnit](https://testingbot.com/resources/courses/selenium-csharp/setup-and-first-test)

On this page

1. [Selenium drives the browser, NUnit runs the tests](https://testingbot.com#selenium-drives-the-browser-nunit-runs-the-tests)
2. [Why NUnit?](https://testingbot.com#why-nunit)
3. [What you'll build](https://testingbot.com#what-you-ll-build)
4. [Prerequisites](https://testingbot.com#prerequisites)

Certification

Earn the free, resume-worthy TestingBot Selenium C# Certification for this course.

[How it works](https://testingbot.com/resources/courses/selenium-csharp/certification)

## Other free courses

- [Mobile App Testing: From First Test to CI A free, hands-on mobile app testing course: emulators vs real devices, Appium vs Espresso vs XCUITest vs Ma...](https://testingbot.com/resources/courses/mobile-app-testing)
- [Accessibility Testing Tutorial: WCAG 2.2 A free, hands-on accessibility testing course: WCAG 2.2 in practice, manual keyboard and screen reader chec...](https://testingbot.com/resources/courses/accessibility-testing)
- [Selenium Locators and Locator Strategies A free course on Selenium locators and locator strategies: CSS selectors, XPath, role-based and test-id loc...](https://testingbot.com/resources/courses/locator-strategies)
- [Flaky Tests: Find, Fix and Prevent Fix flaky tests for good: measure them, then remove the four root causes (waits, shared data, test order, r...](https://testingbot.com/resources/courses/flaky-tests)

[Browse all courses](https://testingbot.com/resources/courses)
