// changelog
Stagehand 4.2: WebMCP tools that change with the page, PDF exports, and more
Stagehand 4.2 adds WebMCP tools that change with the page, native PDF exports, timeouts for locator operations and snapshots, and more reliable iframe and shadow DOM interactions.
Stagehand team3 min read
changelog

++
We're excited to announce Stagehand 4.2!
In this release, we've focused on helping browser agents update WebMCP tools as pages change, export documents programmatically, and give developers more control over how long browser operations run. Here are the highlights:
- WebMCP tools that change with the page — subscribe to
page.onToolsAdded()andpage.onToolsRemoved()to react as websites expose new actions or update their forms. Useful for checkout flows where available inputs and actions change throughout the session. - Native PDF exports — export browser pages as PDFs, with configurable print settings. Save invoices, reports, and other documents directly from your browser workflow.
- Timeouts for locator operations and snapshots — configure
{ timeout }onlocator.click(),fill(), other locator operations, andpage.snapshot(). Defaults to 20 seconds; use timeout: 0 to disable it. - More reliable iframe and shadow DOM interactions — iframe-crossing
page.locator()calls wait for the frame to be ready,page.snapshot({ includeIframes: true })produces correct element references across frames, and XPath text() selectors correctly match direct text on pages with shadow DOM.
Give it a try and tell us what you build!
++