Back to stack index

Automation

Playwright

Browser automation for agent projects.

Short answer

Playwright is Microsoft's open-source library for controlling Chromium, Firefox and WebKit browsers from code, released under the Apache 2.0 license. Built for end-to-end testing, it has become the most common engine under AI browser agents, which read a page, decide what to click or type with a language model, and act through Playwright. In our directory, Browser Use, Skyvern, Browser Operator and Steel rely on Playwright or the Chrome DevTools Protocol it wraps. The latest release is Playwright 1.64.1, from October 14, 2026. Version 1.64 added experimental WebMCP support through page.webmcp and frame.webmcp, letting scripts call tools a website exposes to agents, along with VP9 video recording at custom frame rates, shuffled test order, locator.within() and page.getByRef(). Microsoft also publishes Playwright MCP, a server that gives coding assistants such as Claude Code and Cursor control of a browser. Playwright itself is free; costs come from model calls and browser hosting.

Latest release
Playwright 1.64.1, October 14, 2026
Playwright GitHub releases
License
Apache 2.0
Playwright GitHub
1.64 highlight
Experimental WebMCP: page.webmcp, frame.webmcp
Playwright release notes
Directory projects
Browser Use, Skyvern, Browser Operator, Steel
Project repositories

Updated October 21, 2026How we evaluate tools

Official site

Directory projects (4)

  • Browser Use

    Library for letting models drive a real browser session step by step.

  • Skyvern

    Vision-guided browser workflows when DOM selectors break every week.

  • Browser Operator

    Browser built for agent automation with explicit permission boundaries.

  • Steel

    Hosted browser sessions API for agents at scale.

Playwright for AI browser agents: how Browser Use, Skyvern, Browser Operator and Steel automate the web in 2026

What Playwright is

Playwright was released by Microsoft in 2020, created by engineers who had previously built Puppeteer at Google. It drives Chromium, Firefox and WebKit through a single API, available for TypeScript and JavaScript, Python, Java and .NET. Its test runner, Playwright Test, is one of the most used end-to-end testing tools for web apps.

Features that matter for AI agents:

FeatureWhy agents need it
Auto-waitingActions wait until elements are visible and enabled, reducing flaky steps
Accessibility snapshotsA text tree of roles and names that a model can read cheaply
Locators by role, text and labelAgents can target "the Sign in button" instead of fragile CSS selectors
Browser contextsIsolated sessions with separate cookies, for running many agents at once
Network interceptionBlock ads and trackers, capture API responses, mock services
Tracing and videoReplay what an agent did when debugging
Persistent profilesKeep logins between runs

Which directory projects use it

ProjectWhat it doesRelationship to Playwright
Browser UsePython library that lets any model control a browser to complete tasksBuilt on Playwright originally; now talks to Chrome DevTools Protocol directly with a Playwright-compatible approach
SkyvernAutomates forms and workflows on websites using vision and language modelsUses Playwright to run browsers
Browser OperatorOpen-source browser with a built-in AI agentBuilt on Chromium and its automation interfaces
SteelOpen-source browser API for agents, with sessions, proxies and CAPTCHA handlingExposes browsers that Playwright, Puppeteer or Selenium connect to

Commercial tools such as OpenAI's and Anthropic's computer-use agents also run inside managed browsers, but the open-source projects above let you run the whole loop yourself.

Playwright 1.64

Playwright 1.64.1, the current patch release, shipped on October 14, 2026. New in the 1.64 line:

AdditionWhat it does
WebMCP (experimental)page.webmcp and frame.webmcp APIs to work with tools that pages expose to agents
VP9 videoRecording with a custom frame rate
Shuffled testsRun tests in random order to expose hidden dependencies
Project defaults and group-level locksMore control over test configuration and shared resources
locator.within()Scope a search inside another element
page.getByRef()Target elements by references from snapshots

Version 1.64.1 fixed a regression where packaged Electron apps failed to report their first window, and a regression with cross-origin redirects on Chromium 155 and later. If you automate Electron apps or follow redirects across domains, update to 1.64.1.

Why WebMCP matters

Today, agents operate websites the way people do: read the screen, find a button, click it, and hope the layout has not changed. WebMCP proposes that sites declare tools in the page, such as searchFlights with typed parameters, so an agent can call them directly. Playwright's experimental support means teams can start testing those tools in their own sites before browsers ship full support. If the standard spreads, browser agents will become faster and far less error-prone on cooperating sites.

How a browser agent works

A typical loop in Browser Use or Skyvern:

  1. Open a page with Playwright.
  2. Capture the state: an accessibility snapshot or simplified DOM, often with a screenshot that marks interactive elements with numbers.
  3. Send the task, the state and the history of previous steps to a model.
  4. The model replies with an action, such as click element 14 or type an email into element 7.
  5. Execute the action with Playwright, wait for the page to settle, and repeat until the task is done or a step limit is reached.

Text snapshots are cheaper and faster than screenshots; vision helps with canvas-heavy pages, maps and visual CAPTCHAs. Many agents combine both.

Playwright MCP for coding agents

Microsoft's Playwright MCP server connects a browser to any MCP client, including Claude Code, Cursor, VS Code and Windsurf. The agent gets tools to open URLs, click, type, take a snapshot and take a screenshot. Developers use it to let a coding agent open the app it is building, try the feature, read console errors and fix them. It is also handy for writing Playwright tests: the agent explores the page and then writes a test file with stable locators. See the MCP stack page for how MCP servers work.

Running browsers at scale

OptionNotes
Local headless browsersFine for development and small jobs; one Chromium uses a few hundred MB of RAM
Docker containersOfficial Playwright images include browsers and dependencies; see the Docker stack page
Steel (self-hosted)Open-source browser API with session management, proxies and a live viewer
Hosted browser servicesSteel Cloud, Browserbase, Hyperbrowser and others; billed per browser hour
KubernetesPools of browser containers for high volume; see the Kubernetes stack page

Browsers are heavy. Plan memory for every concurrent session, close contexts when done, and restart long-lived browsers periodically to avoid memory growth.

Cost and reliability

The model calls usually cost more than the browsers. A 20-step task that sends a screenshot and history each step can use a large number of input tokens. Ways to reduce cost and errors:

  • Prefer accessibility snapshots to screenshots when the page allows it.
  • Trim history to the last few steps plus a running summary.
  • Write deterministic Playwright code for steps that never change, such as logging in, and let the model handle only the variable parts.
  • Cache successful action sequences and replay them, falling back to the model only when the page changes; Skyvern and Browser Use both support forms of this.
  • Set a step limit and a timeout for every task.

Common failure modes

ProblemFix
Agent clicks before content loadsWait for network idle or a specific element before capturing state
Pop-ups and cookie banners block actionsDismiss them with fixed code or block their scripts
Infinite loops on the same stepDetect repeated actions and stop or replan
Login walls and two-factor promptsUse saved profiles or hand off to a human
Sites detect automationUse a hosted browser with proper fingerprints, or ask the site for API access

Security

Browser agents read untrusted content, so prompt injection is a real threat: a page can contain hidden text telling the agent to visit another site or reveal data. Limit what the agent can do:

  • Run browsers in isolated containers without access to internal networks.
  • Restrict the domains an agent may visit for a given task.
  • Do not give agents saved passwords or payment details for sites outside the task.
  • Require human approval for purchases, form submissions with personal data and account changes.
  • Log every action with Playwright tracing so you can audit what happened.

Testing AI features with Playwright

Playwright is also the usual tool for testing AI products themselves. End-to-end tests can open a chat interface, send a prompt, and check that a streamed answer appears, that citations render and that error states work. Because model output varies, assert on structure rather than exact text: a response appears within a time limit, it contains a link, the feedback buttons work. For deterministic tests, point the app at a mock model server that returns fixed replies, and keep a smaller set of tests against the real model that check broad behavior.

Choosing a starting point

GoalStart with
Let a coding assistant use a browserPlaywright MCP
Build a Python agent that completes web tasksBrowser Use
Automate forms across many similar sitesSkyvern
Host many browser sessions for your agentsSteel
A browser with an agent built inBrowser Operator
Deterministic scraping or testingPlain Playwright

Related: MCP stack, Python stack, TypeScript stack, Docker stack, Electron stack, Stack index.

Frequently asked questions

Why do AI agents use Playwright?

It controls real browsers reliably across Chromium, Firefox and WebKit, waits for elements automatically, handles multiple tabs, frames and downloads, and exposes the accessibility tree, which gives agents a compact text view of a page. It has official libraries for Python, TypeScript, Java and .NET, so it fits most agent frameworks.

What is WebMCP in Playwright 1.64?

WebMCP is a proposed web standard that lets a website declare tools, such as search products or add to cart, that an AI agent can call directly instead of clicking through the interface. Playwright 1.64 added experimental page.webmcp and frame.webmcp APIs to list and call those tools from scripts and tests. Few sites expose WebMCP tools yet.

What is Playwright MCP?

An official Microsoft MCP server that lets AI assistants drive a browser through Playwright. The assistant receives accessibility snapshots of the page and calls tools to click, type, open pages and take screenshots. Developers use it to let coding agents test web apps they are building.

Is Playwright better than Selenium or Puppeteer for agents?

For most new agent projects, yes. Puppeteer focuses on Chromium and JavaScript; Selenium supports many languages but has a slower, more verbose API. Playwright combines broad browser support, multiple languages, auto-waiting and good tooling. Some agent libraries now talk to Chrome DevTools Protocol directly for speed, while keeping a Playwright-style approach.

How do browser agents avoid being blocked?

Hosted browser services such as Steel, Browserbase and others provide residential proxies, managed fingerprints and CAPTCHA handling. Respect each site's terms of service and robots rules; many sites forbid automated access, and evading bot protection can breach contracts or laws.

Sources

  1. Playwright release notes
  2. Playwright on GitHub
  3. Playwright MCP
  4. Browser Use on GitHub