Browser automation
Driving a browser from code or an agent to test, scrape or complete tasks on websites.
Bookmark
Bookmarks are kept in your free account, so you can find this page again on any device.
Sign in to bookmarkOn this page
Overview
Browser automation controls a real browser from code: open pages, click, type, wait for content and read the result. Frameworks such as Playwright do this with precise selectors; agent tools such as Playwright MCP, Browser Use and Stagehand let a model decide the steps from the page's accessibility tree or screenshots.
Knowing both styles matters. Scripted automation is fast, cheap and repeatable; agent-driven automation copes with pages you have not seen but is slower and less predictable. A common pattern is to let an agent explore and draft a script, then keep the script. Treat page content as untrusted input when an agent is reading it.
What you will practise
- Script reliable browser flows with role-based locators
- Let an agent explore a site through Playwright MCP
- Turn an agent's exploration into a repeatable script
- Limit what a browser agent can reach and do
Tutorials
- Exploratory testing with Playwright MCP
Give a coding agent a browser through Playwright MCP, run a time-boxed exploratory charter, record findings, and turn the confirmed ones into Playwright specs.
- Playwright test agents: planner, generator and healer
How Playwright's planner, generator and healer test agents work, how to set them up with Claude Code or VS Code, and how to review the tests they write for you.
Workflow recipes
- Generate Playwright tests with AI agents, then review them
Approve a test plan before any code exists, generate tests from it and review them like production code.
- Run an accessibility audit with an agent
Run an AI accessibility audit against WCAG 2.2 AA with Playwright, axe-core and an agent, add the manual checks scanners miss, and rank fixes by user impact.
- Fix flaky E2E tests with the Playwright healer, safely
Prove the flake, run Playwright's healer agent on a branch, check each change for red flags, keep a heal log and merge by hand.
Articles
- MCP servers worth installing, checked
A short list of MCP servers worth installing for browsers, GitHub, docs and databases, with the access each one needs and the security settings to turn on.
Tools for this skill
Browser Use
Open-source library and cloud service for AI agents that operate websites.
Browserbase
Hosted headless browsers for agents, with sessions you can watch and debug.
Chrome DevTools for agents
MCP server and CLI for agents to debug live Chrome.
Crawl4AI
Open-source crawler that turns web pages into clean Markdown or JSON for RAG and agents.
Playwright
End-to-end testing framework for web apps, with built-in test agents.
Playwright MCP
MCP server that lets agents drive a browser through Playwright.
Stagehand
Browserbase's SDK for browser agents, mixing natural-language actions with code.
Key terms
Words you will meet while learning this, defined in the glossary.
- Agentic browser
A web browser with a built-in assistant that can click, type, fill in forms and move between sites for you, inside your own browsing session.
- Browser agent
An agent that navigates websites and acts on them, such as filling forms, clicking through flows or extracting information from pages.
- Computer use
A model controlling a computer or browser by looking at screenshots and issuing mouse and keyboard actions, step by step, like a person would.