Open source · MIT

Drive the browser directly.

Motus is a browser automation and testing framework for .NET that talks straight to Chromium and Firefox over CDP and WebDriver BiDi. No Node.js sidecar, no driver binary, no process boundary. Source-generated bindings, NativeAOT-ready, and every built-in feature is a plugin.

BrowsersChromium · Firefox
ProtocolsCDP · BiDi
Runtime.NET 8 · .NET 10
LicenseMIT
▶ motus run SearchTests.cs
SearchTests.cs MSTest
1var page = await Context.NewPageAsync();
2await page.GotoAsync("https://example.com");
3
4await page.GetByRole("searchbox")
5 .FillAsync("motus automation");
6await page.GetByRole("button", "Search")
7 .ClickAsync();
8
9await That(page).ToHaveUrlAsync("**/search**");
10await That(page.Locator(".results"))
11 .ToBeVisibleAsync();
https://example.com/search?q=motus+automation live
Search
✓GotoAsync128 ms
✓FillAsync41 ms
✓ClickAsyncGET 200
✓ToHaveUrlAsyncok
✓ToBeVisibleAsyncok
✓passed5 steps · 312 ms
One test. Watch every action replay in the visual runner.

No sidecar. No driver. No shortcuts.

Every .NET browser automation framework either wraps a JavaScript tool behind a process boundary or bolts extensibility on as an afterthought. Motus does neither.

It speaks to the browser over a raw WebSocket: the Chrome DevTools Protocol for Chromium, WebDriver BiDi for Firefox. Protocol types are source-generated at build time and marshalled with System.Text.Json source generators, so the engine is reflection-free and NativeAOT-ready. And every built-in selector strategy, lifecycle hook, wait condition, and reporter is registered through the same public plugin context any consumer can use. If a built-in needed private access, the interfaces would be incomplete.

Direct protocol

Straight to the browser

No Node.js process to proxy commands, no chromedriver or geckodriver to version and manage. Motus holds the WebSocket itself and dispatches trusted, browser-level events with nothing in between your test code and the protocol.

See the architecture
Honest extensibility

Every feature is a plugin

The five built-in selector strategies, the console, HTML, JUnit, and TRX reporters, the visual runner timeline, and the nine WCAG rules are all registered through the same IPluginContext your own plugins use. No internal shortcuts.

Explore the plugin model

A complete testing toolkit, built in.

Locators that never go stale, auto-retrying assertions, network mocking, accessibility and performance budgets, coverage, and full tracing. Nothing to bolt on, no third-party packages for the essentials.

SEL

Selectors

CSS, XPath, Text, ARIA Role, and Test ID strategies, plus semantic helpers like GetByRole and GetByLabel. Add your own with ISelectorStrategy.

WAIT

Auto-wait

Every action waits for the element to be attached, visible, stable, and enabled before acting, with a configurable timeout. Explicit sleeps are unnecessary.

EXP

Assertions

Polling assertions for locators, pages, and responses retry until they pass or time out, with .Not negation. Transient DOM and protocol errors are retried, not thrown.

NET

Network

Intercept any request by URL glob. Mock with FulfillAsync, forward with ContinueAsync, or cancel with AbortAsync, on a page or a whole context.

A11Y

Accessibility

WCAG 2.1 Level A/AA audits against the browser's native accessibility tree, no JavaScript injection. Nine rules built in, extensible via IAccessibilityRule.

PERF

Performance

Core Web Vitals (LCP, FCP, TTFB, CLS, INP) collected during the run. Set budgets with [PerformanceBudget] or config and regressions fail the test.

COV

Coverage

Per-test JavaScript and CSS coverage via CDP, remapped to original sources, aggregated across the run, with thresholds that fail the build in CI.

TRACE

Tracing

Screenshots, DOM snapshots, network logs, HAR export, and WebM video. Trace archives open in the visual runner with a full timeline.

PAR

Parallel

Context-level, browser-level, and worker-level parallel execution, with a browser pool that detects crashes and replenishes itself.

SHDW

Shadow DOM

Open shadow roots are pierced automatically, configurable per locator, so components built on web components stay addressable.

ATTCH

Attach

Drive a browser you did not start. Connect to a debugging endpoint and its open tabs are yours, including signed-in profiles, warm browsers reused across runs, and Chromium-based desktop apps. Motus never ends a browser it did not start.

FRAME

Frames

Locators scope to the frame they came from, to any nesting depth. Frames the browser renders in their own process are ordinary frames here, with an isolated world available when the page's scripts are in the way.

AOT

NativeAOT

Source-generated protocol bindings and plugin discovery mean zero reflection, so Motus trims and publishes ahead-of-time cleanly.

DIAG

Analyzers

Seven Roslyn diagnostics catch unawaited calls, hardcoded delays, fragile selectors, and undisposed browsers at compile time, with code fixes.

Reads like the page. Retries like a test.

Semantic locators target what users see. Assertions poll until the page settles. Network mocks and accessibility audits are first-class, not add-ons.

Locators page.GetByRole("listitem") .Filter(new LocatorOptions { HasText = "Product A" }) .Locator("button") .ClickAsync();
Assertions await That(page) .ToHaveTitleAsync("Dashboard"); await That(page.Locator(".spinner")) .Not.ToBeVisibleAsync();
Network mocking await page.RouteAsync( "**/api/products", async route => await route.FulfillAsync( new RouteFulfillOptions { Status = 200, Body = productsJson }));
Accessibility await That(page) .ToPassAccessibilityAuditAsync(); await That(page.Locator("nav")) .ToHaveRoleAsync("navigation");

One contract. Layers that swap out.

Test code talks to locators and assertions. Those talk to pages and contexts. Those talk to a transport that holds a raw WebSocket. Each layer depends only on the public contract below it.

Layer 1 · Surfaces

How you drive it

Test framework integrations, the CLI runner, the Blazor visual runner, and an MCP server for AI agents. All consume the same engine.

Motus.Testing.*
Motus.Cli
Motus.Runner
Motus.Mcp
↓
Layer 2 · Engine

The core

Browser management, the page controller, locators, selectors, and assertions, plus recording, codegen, and the Roslyn tooling that supports them.

Motus
Transport (CDP / BiDi)
Locators · Selectors
Assertions
Motus.Recorder
Motus.Codegen
↓
Layer 3 · Abstractions

The contract

Public interfaces and types with zero dependencies. The only package a plugin author references, and the boundary every layer is written against.

Motus.Abstractions
[MotusPlugin]

All CDP and BiDi types are source-generated at build time from the protocol schema, and serialization runs through System.Text.Json source generators. The transport holds a raw WebSocket directly: no HTTP round-trip per command, no intermediate process, no Node.js runtime.

The transport layer, end to end

A handful of interfaces. Zero private APIs.

Every extension point in Motus is an interface in Motus.Abstractions, registered through IPluginContext. The same interfaces the built-ins use are the ones you use.

ISelectorStrategyResolve elements and generate selectors for a custom prefix, such as a project's own test-id attribute.
ILifecycleHookIntercept navigation, actions, page create and close, console messages, and page errors.
IWaitConditionDefine named wait conditions for use with WaitForAsync.
IReporterReceive test-run events for custom reporting. Multiple reporters run at once.
IAccessibilityRuleAdd WCAG rules evaluated against the browser's accessibility tree.
IAccessibilityReporterOpt-in companion for reporters that want per-violation accessibility events.
IPerformanceReporterOpt-in companion for reporters that want performance metrics and budget results.
ICoverageReporterOpt-in companion for reporters that want per-test and aggregated JS/CSS coverage.
IMotusLoggerStructured logging for plugin diagnostics.

Discovered at compile time

Mark a class with [MotusPlugin] and the Roslyn source generator emits a module initializer that registers it at startup. No assembly scanning, no reflection. Or pass instances through LaunchOptions.Plugins for full control.

$dotnet add package Motus.Abstractions

Dogfooded all the way down

The CSS, XPath, Text, Role, and Test ID strategies are plugins. The console, HTML, JUnit, and TRX reporters implement IReporter. The visual runner's timeline is an ILifecycleHook. The nine WCAG rules and the audit hook are plugins too. None has special access to engine internals.

Only one dependency

A plugin project references just Motus.Abstractions, which carries the source generator as an analyzer, so [MotusPlugin] discovery works the moment you add it.

Hand the browser to an agent.

The same engine that runs your tests is exposed to AI agents through a Model Context Protocol server, shipped as the motus mcp verb on the CLI. Agents address elements by stable references from accessibility-tree snapshots, not brittle coordinates.

They navigate, snapshot, click and type, act at raw coordinates on canvas surfaces including drag and drop, intercept network traffic, run accessibility and performance audits, record traces, HARs, and videos, and generate Page Object Model code, all over stdio or Streamable HTTP.

$dotnet tool install --global Motus.Cli
$claude mcp add motus -- motus mcp

Read the MCP server guide

Tool catalog55 tools
Navigationnavigatego_backreloadwait_for
Perceptionsnapshotscreenshotaudit_accessibilityget_performance
Interactionclicktypepresshoverselect_optionupload_files
Coordinatesclick_xydragscroll_xyresize
Networkroute_fulfillroute_abortnetwork_requests
Recordinggenerate_pomtrace_starthar_startvideo_start
Framesframe_listframe_select
Browserbrowser_attachbrowser_status

Bring your runner. We fit in.

Motus integrates with the three major .NET test frameworks. Pick the package that matches your suite and inherit a base class or wire up a fixture.

MSTest

MotusTestBase

One browser shared across the assembly, an isolated context and page per test. Compatible with MSTest parallelization.

$dotnet add package Motus.Testing.MSTest
NUnit

MotusTestBase

A browser per fixture class with no assembly setup, an isolated context and page per test. Works with parallelizable scopes.

$dotnet add package Motus.Testing.NUnit
xUnit

Collection fixtures

A SharedBrowserFixture per collection and a BrowserContextFixture per class, with a ready-made MotusCollection.

$dotnet add package Motus.Testing.xUnit

Write less of the test by hand.

7.1Record a session

motus record opens a headed browser, captures your interactions, and emits idiomatic C# for MSTest, xUnit, or NUnit, with a configurable selector priority.

7.2Generate page objects

motus codegen crawls a live page, infers the best selector for each interactive element, and writes a typed Page Object Model class.

7.3Visual runner

motus run --visual launches a Blazor runner with a live screencast, an action timeline, and step-through controls.

7.4Visual regression

Pixel-level diffs, side-by-side comparison, and baseline management, built into the visual runner.

7.5Screenshots & PDF

motus screenshot and motus pdf capture full pages from a URL, with delay, banner-hiding, and sizing options.

7.6Open a trace

motus trace show opens a trace archive in the visual runner with its timeline, screenshots, and network log.

Coming from somewhere else? It is familiar.

The locator and assertion vocabulary will feel known. The differences are mostly things you no longer have to do.

From Playwright for .NET

Drop the Node sidecar

No bundled Node.js process and no playwright install build step. Swap the launch call, change Expect( to Expect.That(, and inherit MotusTestBase. Method names line up, and accessibility assertions are built in.

Migration guide
From Selenium WebDriver

Drop the driver binary

No chromedriver or geckodriver to pin. Lazy ILocator objects never go stale, auto-wait replaces explicit waits, and the API is fully async. The PageFactory pattern is no longer needed.

Migration guide
Configuration

Layered and code-last

A motus.config.json file, then MOTUS_ environment variables, then code, in that order, with code always winning. One place for launch, assertion, accessibility, performance, and coverage settings.

Configuration guide

Add the package. Write a test.

Library

Core engine

The one package every project needs: transport, browser management, locators, selectors, and assertions.

$dotnet add package Motus
$dotnet add package Motus.Testing.MSTest
Motus on NuGet
Terminal

CLI & a browser

The global tool runs tests, records, generates code, and hosts the MCP server. motus install downloads a browser.

$dotnet tool install --global Motus.Cli
$motus install
Motus.Cli on NuGet
Quality

Compile-time checks

Optional Roslyn analyzers flag the common automation mistakes before a test ever runs, with fixes for several.

$dotnet add package Motus.Analyzers
Read the docs

Your first test, start to finish.

Inherit the base class, open a page, act through locators, and assert. The browser is launched once for the assembly and a fresh context is handed to each test.

using Motus.Testing.MSTest;
using static Motus.Assertions.Expect;

[TestClass]
public class SearchTests : MotusTestBase
{
    [TestMethod]
    public async Task ClickLink()
    {
        await Page.GotoAsync("https://example.com");
        await Page.GetByRole("link", "More information...").ClickAsync();
        await That(Page).ToHaveUrlAsync("*iana.org*");
    }
}

Open source. Built in public.

Motus is a Datafication project, MIT licensed end to end. Issues, discussions, and plugin ideas are welcome.

2Protocols, no sidecar
53MCP tools
9Plugin interfaces
MITLicensed