Skip to content

motus-v1.1.0

Latest

Choose a tag to compare

@github-actions github-actions released this 15 Sep 11:26
· 22 commits to main since this release

This release is about two things: an MCP server that an agent can work with rather than around, and a browser that stays put. The server now hands an agent a snapshot a third the size it was, says what each action changed, takes a selector anywhere it took a ref, folds frames into the page, and ships a catalog that carries only what a session asks for. Underneath, a Chromium browser Motus starts on macOS or Linux is driven over a pipe and cannot outlive the process that started it, a killed test run no longer leaves browsers behind, and a cross-origin frame no longer vanishes when the browser moves it between processes. Four defects found while writing the docs are fixed too: a context route never reached a tab that was already open, every trace came out empty, a page-level role= selector threw, and the alt-text rule never fired on Chromium. Fourteen behavior changes are called out below; each would otherwise read as a regression.

A coming release will drop .NET 8

.NET 8 leaves Microsoft support on November 10, 2026, and .NET 9 ends the same day, so the library, the motus command line tool, and the test framework packages will move to .NET 10 ahead of that date. Nothing changes in this release: every package still ships a .NET 8 build beside its .NET 10 build, and a suite on .NET 8 keeps running. Installing the .NET 10 SDK now means the switch will pass unnoticed when it comes.

Browser reliability

  • A browser Motus starts on Unix cannot outlive it - A Chromium browser launched on macOS or Linux is driven over --remote-debugging-pipe rather than a debugging port. The pipe carries a liveness signal a port does not: the browser exits when its end closes, so a test host that is killed outright, SIGKILL included, takes its browser with it. There is no endpoint to discover and nothing to poll. Firefox has no pipe mode and Windows has no way to hand a child a file descriptor, so both keep the port, and a browser you attach to always uses a WebSocket.
  • Signal handlers that actually run - HandleSIGINT and HandleSIGTERM were wired to ProcessExit and CancelKeyPress, neither of which fires for a signal on Unix, so the browser they promised to close was left running by every Ctrl+C and every kill. They are now real signal registrations, and HandleSIGTERM covers SIGHUP as well because a closed terminal ends a process the same way. The handler closes the browser and waits up to five seconds before ending it outright, and none of the signals is cancelled, so the process still ends the way it always did, only with the browser gone first. On Windows, a job object ends the browser when the host's handles close.
  • A cross-origin frame survives a process swap - The browser announces a frame it moves into another renderer as a detach with the reason swap, and says the same for a document it puts into the back-forward cache. Both were treated as the frame going away, so a frame handle went dead and the frame dropped out of page.Frames at a moment chosen by the browser, which is what made the first test against a cross-origin iframe skip or fail for no reason it could name. A swap now keeps the frame, a real removal still removes it, and a frame committing a new document drops the frames it hosted, since the new document reports its own. Frame events are read from one ordered channel per session so the rule sees them in wire order.
  • Frames come in attach order - IFrame.ChildFrames and frame_list promised document order and delivered whatever a dictionary returned. They now keep the order frames attached in, which is the order they appear in the page unless the page inserted one later, and a frame the browser moves into its own process keeps its place.
  • A connect timeout says which stage was waiting - ConnectAsync bounds three stages out of its one budget and names the one that ran out: the debugging endpoint never answered with a WebSocket URL, along with what the last attempt to reach it said; it named a URL and that WebSocket never finished opening; or the socket opened and the browser never finished reporting its version and handing over its tabs. A refused connection, a name that will not resolve, and something else listening on the port all looked the same before.
  • Timeouts reach typing, key presses, and select - KeyboardTypeOptions and KeyboardPressOptions gain a Timeout, ILocator.SelectOptionAsync gains an overload taking one, and Filter honors the timeout it is given. A configured action timeout now applies to the whole action surface rather than to clicks and fills alone, which is what lets motus mcp --timeout reach type, press, and select_option.
  • Popups are tracked wherever they open - A tab opened by window.open or a target="_blank" link is a page of the context that opened it, for a browser Motus started as well as one it attached to. context.Pages lists it, IPage.Popup fires on the opener with a page that is ready to drive, and the tab takes the context's viewport, user agent, and recording. Attaching with adoption turned off narrows what is taken over, not what is watched: a popup in a context you created is still tracked, while tabs belonging to whoever else is using the browser stay out of it.

MCP server: what the agent sees

  • A snapshot says each thing once - The browser's tree carries every label three times, as the element, the static text inside it, and the inline text box that text is laid out in, and every one of them took a ref, layout wrappers and list bullets included. On the Wikipedia article on WCAG that came to 275,000 characters and 3,015 refs. The serializer now prints the element alone, folds text into the element it names or prints it inline after a colon, drops layout-only nodes, lets an unnamed wrapper with one child step aside for it, and hands refs only to nodes worth targeting: interactive roles, named nodes, focusable nodes, and iframes. The same article is now 114,000 characters and 866 refs, which is less than Playwright's MCP server produces for the same page. Headings show [level=N] and links show [url=...], both missing before, and a name containing a quote is escaped rather than printed as is. audit_accessibility follows the same rule: a violation on a node the snapshot gave no ref, such as an image with no alt text, reports ref as null and identifies the node by nodeRole, nodeName, the new nodeText, and selector.
  • Frames are part of the page - An iframe whose content could be read prints [frame=N] and its content directly underneath, nested as deep as the page nests them. Refs inside carry the frame's index as a prefix, so f1e2 is the second addressable element of frame 1, and passing it to click or type acts inside the frame with nothing selected first. Ten frames are read by default and max_frames on snapshot changes that; past the limit, and for a frame that is hidden or unreadable, the snapshot says how many were left out and points at frame_list and frame_select, which still scope the session to one frame when that is the better shape.
  • An action says what it changed - Every action came back as one line, Clicked e16, whether the click had done nothing at all or had opened a tab, logged an error, thrown an uncaught exception and navigated the page out from under the refs the agent was holding. Finding out which took a snapshot, a console_messages and a tab_list. An action result now carries a short block under its first line, and only the rows that apply: where the page ended up and what it calls itself when either changed, a tab the page opened with the index tab_select takes, how many errors and uncaught page errors the action logged along with the cursor that reads exactly those, a dialog it left open, and a line saying the refs from the last snapshot no longer address the page when the action navigated it. A click on a quiet page is still one line. Because the browser accepts a click before it has followed the link, the result waits half a second for the page to show what happened, and --settle sets that wait. click, type, press, select_option, set_checked, navigate, reload, go_back and go_forward also take snapshot: true, which appends a fresh snapshot to the result, and navigate names the page it landed on by title rather than only the URL it was given.
  • A selector works anywhere a ref does - Every tool that takes a ref now takes a selector in its place: CSS by default, or prefixed with xpath=, text=, role=, or data-testid=. A ref is a name the last snapshot handed out, so it is only as current as that snapshot; a selector describes the element itself and needs no snapshot at all. That is the way back when refs have gone stale after a navigation, and the shorter way in when the element is already known by a stable selector. Anything shaped like a ref is still read as one, so a ref the latest snapshot no longer holds comes back as a stale ref rather than as a selector that matched nothing, and a selector is searched in the frame selected at the time of the call.
  • click can use the other mouse buttons - It takes button (left, right, middle) and modifiers (Alt, Control, Meta, Shift), so a context menu or a ctrl-click reaches an element by ref or selector rather than only by coordinate. Both run the same visible, enabled, settled and receiving-events checks as a plain click. A double-click stays left-button only, and says so rather than quietly dropping the button.
  • A dialog no longer stops the session for a minute - Clicking a button whose handler calls alert() used to hang for a full minute and then fail with A task was canceled., which said nothing about a dialog. The browser stops answering input the moment a dialog goes up, so the command that dispatched the click was left unanswered until the transport gave up on it. Every action now runs against the dialog event: the moment one opens, the call returns The action opened an alert dialog: "Are you sure?". Call handle_dialog to accept or dismiss it. Results from later calls say a dialog is open until it is answered, an action asked for while one is open is refused straight away rather than dispatched into a page that cannot receive it, and --dialogs accept or --dialogs dismiss answers them without the round trip.
  • One request in full - network_request takes the sequence number network_requests prints in front of each line and returns what the log holds for that request: the method, status, URL and resource type, the request and response headers, the request body, and the response body when the browser can still produce it. Headers are copied when the request is logged; the body is fetched only when it is asked for, because a page that downloads a file would otherwise keep the file in the server's memory for as long as the log held the entry. The browser drops response data on a navigation, so a request from a document the page has left says the body is gone rather than inventing one.
  • Tabs are numbered across contexts - tab_list covers every tab the session has open, whichever context it is in, and names the context on each row once more than one is open. tab_select and tab_close take those numbers and move the session to the tab's context when they have to, so a tab that can be seen can be worked in without naming its context first. tab_open still follows the active context, so context_select decides where a new tab goes.
  • Errors say what happened - A missing argument is reported as The 'ref' argument is required., naming the field the caller left out, rather than Value cannot be null. (Parameter 'key'), which named a dictionary inside the server. Every tool checks the arguments it cannot work without before it touches the browser. A cancellation that reaches a tool is reported as a timeout that says how long it waited and what it was waiting for, instead of A task was canceled.

MCP server: what the operator controls

  • A catalog that carries what the session needs - The default catalog is 34 tools, down from 55, and a third smaller in the schema an agent reads at every turn. Coordinate input (click_xy, hover_xy, move_xy, scroll_xy, drag, resize), recording (trace_*, har_*, video_*), isolated contexts (context_*), and request mocking (route_*, unroute) are named with --caps coordinates,recording,contexts,routing, repeated or comma-separated, with MOTUS_MCP_CAPS in the environment or mcp.caps in motus.config.json as the other two ways in. The flag wins over the variable and the variable over the file. Naming a group only adds; the always-available tools are there whatever it says.
  • The browser the server starts is configurable - motus mcp now carries the launch and context settings an agent session needs to match the machine it runs on: --browser-arg (repeatable, and --browser-arg=--no-sandbox is what a container running as root needs before Chromium will start at all), --executable-path, --user-data-dir, --storage-state, --proxy-server and --proxy-bypass, --user-agent, --locale, --timezone, --timeout and --navigation-timeout, --settle, --dialogs, and --config to take defaults from a motus.config.json that already exists rather than restating them on the command line. --channel is honored for the first time: it was read only to look up a browser motus install had downloaded, and the options the browser was actually started with never carried it, so --channel firefox on a machine without Firefox started Chromium instead and the session went on describing itself as Firefox. A channel that was named and cannot be found now stops the server and says which install command to run, with --executable-path as the way past it.
  • Boundaries an agent cannot talk its way past - Files are written inside one output directory and read from the roots the MCP client reports, file:// URLs are refused, and browser_attach is advertised only when the operator allowed it. Each is a behavior change and is spelled out below. --allow-unrestricted-file-access restores the old file behavior for anyone who was relying on it.

Fixes

  • A context route reaches a tab that was already open - context.RouteAsync copied the rule to every open page, but the page-level bookkeeping decided the browser's request interception was already on because the context rule existed, so it never turned it on. A mock registered after the page opened was silently ignored until the next page. Interception state is now owned by the page's network layer behind a gate and enabled from the real state rather than a rule count, so a context rule applies to every open page from its next request onward, and to every page opened later from its first.
  • Traces have events in them - Tracing.StopAsync wrote a ZIP holding an empty trace.json, every time, headless or headed, and motus trace show reported "No actions recorded". The browser returns a streamed trace as one JSON object holding a traceEvents array, sometimes gzip-compressed, and the reader accepted only a bare array and parsed each chunk of the stream on its own. Chunks are now accumulated and the payload read in either shape, compressed or not. The viewer and the screenshot extractor also read a trace event's categories as the comma-separated list they are, so an event carrying more than one category is no longer skipped.
  • page.Locator("role=button") works - A page-level role selector threw Either nodeId, backendNodeId or objectId must be specified, because the accessibility query was sent with no root when nothing narrower than the page was asked for. It is now rooted at the page's document like every other strategy. page.GetByRole was never affected, which is why the samples did not catch it; the MCP role= selector prefix was.
  • The alt-text rule fires on Chromium - a11y-alt-text matched the role img, and Chromium reports image, so an image with no accessible name was never reported. Both spellings are accepted, in the color-contrast rule's list of non-text roles as well.
  • Deep descendants stay in the accessibility tree - Building the tree copied nodes as it wired children, so a node several levels down could be dropped from its parent chain. Each node's own child list is populated now, and a nested main, region, article structure keeps every heading and button under the element that holds it.

Documentation

  • MCP guide - New Request mocking and isolated contexts sections with screenshots, the parameters that were missing from type, click, screenshot, evaluate, audit_accessibility, generate_pom, trace_start, and wait_for_element, the attach case in crash recovery, the HTTP transport's idle timeout, and the full option table including --caps and --settle.
  • Network interception describes what the code does - The guide claimed * stopped at a path separator and the first matching handler won. A pattern is an exact match, a glob that must cover the whole URL with * crossing /, or a plain substring; the most recently registered matching handler runs; one handler takes a request and nothing falls through; and a brace list such as {png,jpg} is literal text, so the old samples matched nothing. The samples are rewritten to patterns that match.
  • Getting started and the migration guides - Mouse buttons and modifier clicks, per-call timeouts, and a callout on popups, with the Playwright and Selenium tables mapping the new click and select overloads. The transport paragraphs no longer say WebSocket everywhere.
  • Architecture - Browser lifecycle covers the pipe, the signal handlers, the Windows job object, the three connect stages, and a new section on popups and new tabs; Transport and protocol covers CdpPipeSocket beside the WebSocket. Frames and iframes gains the process swap trap.
  • Pictures - Eight screenshots across getting started, accessibility, configuration, flaky tests, network interception, browser lifecycle, and the MCP guide, most taken with Motus.
  • Housekeeping - Line endings are normalized to LF for the files that predated the .gitattributes rule, so a diff against 1.0.15 looks larger than it is. The README describes the pipe transport, --caps, and attaching, and its command list matches the CLI again.

Behavior changes

  • MCP: the default catalog is smaller - A client that ran plain motus mcp and used click_xy, drag, resize, the context_* tools, the route_* tools, or trace, HAR, and video recording will find them gone until its command line names the group with --caps. The 34 tools that remain need no option and cannot be turned off.
  • MCP: browser_attach needs an option - The tool connected the session to any debugging endpoint the agent named, which on a machine running a debug-enabled browser meant moving into somebody's signed-in sessions on the agent's own initiative. It is now in the catalog only when the server was started with --allow-attach, or with --connect, which implies it, and refuses the call if it is ever reached without one. Sessions started with --connect are unaffected.
  • MCP: artifacts are written inside an output directory - trace_stop, har_stop and video_start took any path the agent handed them and wrote there, and upload_files read any file on the machine. Paths are now resolved inside one output directory, a directory for this run under the temporary directory unless --output-dir names another, and an absolute path, a path that climbs out with .., or one that follows a symbolic link out is refused. Reads are confined to the roots the MCP client reported, or to the working directory and the output directory when it reports none. The directory is printed to standard error at startup and every result that writes a file echoes the absolute path. Under --http every session shares the one directory. --allow-unrestricted-file-access restores the old behavior.
  • MCP: file:// URLs are refused - navigate, tab_open and the route tools no longer open a local file, including through a redirect a mock sets up. An agent reads back whatever it navigates to, so a page that talks it into a file: URL was reading the machine's files through snapshot and evaluate. Anything with no scheme is still treated the way a typed address would be. --allow-unrestricted-file-access enables it again.
  • MCP: the console and network logs no longer empty themselves when they are read - console_messages and network_requests cleared their buffer on every read, so a reply that failed on its way to the agent took the entries with it, a retry found nothing, and two readers took entries from each other. Every entry now carries a sequence number and stays until the 250-entry buffer pushes it out. Both tools take since, a sequence number to read from, and both end with a next=N line to pass back as the next since; a read that misses entries the buffer has already dropped says how many. A client that reads without since now gets everything the buffer holds rather than only what arrived since its last call, so a client that polled in a loop should start passing the cursor.
  • MCP: tab numbers span contexts - tab_list used to number the active context's tabs from one; it now numbers every open tab in one sequence across contexts. A client that held a tab index across a context_select will find it points at a different tab.
  • MCP: a snapshot on a browser without an accessibility tree says which browser is the problem - Refs come from the accessibility tree, which is read over the Chrome DevTools Protocol, so a Firefox session had no tree to render. The empty result was read as a page with nothing addressable in it and answered with the note about canvas-drawn interfaces, which sent the agent looking at the page for a problem that belonged to the browser. The snapshot now states the limitation and points at the coordinate tools, which work either way.
  • AccessibilitySnapshotAsync nests a descendant of an ignored node under its nearest surviving ancestor - Browsers mark a great many wrapper elements as ignored, and the tree was built by skipping those nodes outright, which left everything beneath them attached to nothing. Those stranded subtrees were promoted to the top level, so a form inside a stack of layout divs came back beside main rather than inside it, and banner and main came back as siblings of the document rather than its children. Descendants of an ignored node now take that node's place in its parent's child list, and Roots is normally the document alone. Code that walked Roots expecting orphaned subtrees at the top level will find them in place instead. Both readers of the tree change with it: the MCP snapshot tool, and accessibility audits, which now report the element's real position in the page.
  • A page Motus did not open can now appear in context.Pages - Motus watched what opened in a browser only while attached to one it did not start. A browser Motus started now watches too, so context.Pages, the context's Page event, IPage.Popup and the page lifecycle hooks all report tabs the page opened for itself rather than only the ones that were asked for. Code that assumed a context holds exactly the pages it created, or that counted pages to decide which one to act on, will see the extra tab. Tabs in browser contexts Motus never created are still ignored for a browser Motus started, so the window the browser opens for itself is not one of them.
  • A context route applies to pages that are already open - A rule registered on the context after a page was opened used to be ignored on that page for good. It now applies from the page's next request. A test that registered a mock, opened nothing new, and relied on the live server answering anyway will start getting the mock.
  • Tracing.StopAsync fails rather than writing an empty trace - A trace payload that cannot be read now throws MotusProtocolException naming the read that failed, where before it produced a ZIP with no events and nothing said otherwise. Anything that treated a 122-byte trace as success will now see the error, which is the right outcome; the sample test that only checked the file existed has been tightened for the same reason.
  • a11y-alt-text reports images on Chromium - The rule never fired there, so a suite asserting ToPassAccessibilityAuditAsync against a page with an unnamed image passed. It will fail now, and the audit hook in warn mode will print violations it never printed. Add alt text, or skip the rule with SkipRules("a11y-alt-text") while that is done.
  • A page-level role= selector returns matches instead of throwing - Code that caught MotusProtocolException around page.Locator("role=...") as a workaround can stop; a selector that matches nothing returns an empty result like any other.
  • A launched Chromium on Unix exits with the process - A test host that was killed, or that ended on a signal, used to leave its browser running with a motus-profile- directory behind it. Both are gone now. A context Motus creates in a browser it started is no longer marked to dispose itself when the connection detaches, because a browser that answers a detach by disposing contexts does not also act on the pipe closing and would sit idle with nothing left in it; that is only visible to code that called DisconnectAsync on a launched browser and expected its contexts to have been disposed in the browser.

Contracts

ILocator gains ClickAsync(MouseButtonOptions, double?) and SelectOptionAsync(string[], double?), and KeyboardTypeOptions and KeyboardPressOptions gain a Timeout. These are additive for callers and breaking for anyone implementing ILocator, which in practice means test doubles. Nothing else in Motus.Abstractions changed shape.