BXUP Track progress & test yourself — free
QA & Testing · Playbook · Core · ~5 min read
QA & TESTING · PLAYBOOK · CORE

Drive a Real Browser with Playwright MCP — Exploration, Repro, and Test Drafting

The official Playwright MCP server lets an LLM drive a live browser through accessibility-tree snapshots — no screenshots, no pixel guessing. Directed well, it becomes a tireless exploratory tester, a repro machine for vague bug reports, and a drafting hand for new specs, while you keep the tester's judgment.

Tier: Core · Workflow area: Agentic test stack & self-healing

This playbook wires Playwright MCP into your assistant and runs three high-value session types — exploratory sweep, bug reproduction, and test drafting — each with a human verification step before anything is believed or committed.

USE IT WHEN

A driven browser beats a described one

  • Exploratory sweeps of a new build: the model tours flows and reports anomalies while you direct toward risk.
  • A bug report says "sometimes the cart empties" — you want dozens of patient repro variations tried without burning your afternoon.
  • Drafting specs from real DOM state instead of hallucinated selectors — the model reads the actual accessibility tree.
SKIP IT WHEN

The tool shape is wrong

  • You need repeatable CI checks — that is a committed Playwright suite, not an interactive session.
  • The flow needs CAPTCHA, real payments, 2FA, or production credentials — do not put an LLM's hands on those controls.
  • Deep visual/layout bugs: the accessibility tree will not show a broken gradient or an overlapping div; use screenshot review instead.

Prerequisites

  • Node 18+ and an MCP-capable assistant: Claude Code, VS Code Copilot, or Cursor.
  • MCP server registered — for Claude Code: claude mcp add playwright -- npx @playwright/mcp@latest.
  • A test environment with a seeded account; never a production login.
  • A session-sheet template (charter, timebox, findings) if you run exploratory sessions formally.

The workflow

  1. Verify the wiring with a trivial errand. "Open http://localhost:3000, tell me the page title and the main navigation items." The reply should quote real DOM content — this confirms snapshots flow before you invest in a session.

  2. Exploratory sweep — charter first, then direct. Give the model a charter, a persona, and reporting rules:

    You are exploring the signup flow at http://localhost:3000 for 20 minutes.
    Charter: hunt input-validation and error-recovery problems.
    Try: emails with unicode and plus-addressing, a 300-char name, double-clicking
    submit, going Back mid-flow, expired-session resubmission.
    Report each anomaly as: STEPS | EXPECTED | ACTUAL | SEVERITY-GUESS.
    Do not mark anything a bug without stating what you expected and why.
    

    Steer live ("interesting — push harder on the Back-button case") exactly as you would pair with a junior tester. Sample finding you should expect back:

    ANOMALY 3
    STEPS: entered "José+test@exämple.com", submitted, corrected to plain ASCII, resubmitted
    EXPECTED: second submit succeeds
    ACTUAL: button disabled permanently; page reload required
    SEVERITY-GUESS: medium — recoverable but user-visible dead end
    
  3. Verify every finding yourself. Reproduce each anomaly by hand or replay its steps before it goes anywhere near a tracker. The model misreads app intent regularly — an unfamiliar-but-correct behavior is not a bug. Your session sheet records which findings survived verification.

  4. Repro session — turn a vague ticket into steps. Paste the ticket and constrain the search:

    Bug report: "cart occasionally empties after login". Try to reproduce on
    http://staging.example.test with user qa-cart-01.
    Vary one factor at a time: add-to-cart before vs after login, session idle 0/5/30 min,
    second tab logged into the same account, login via email vs SSO button.
    After each attempt report: variation | cart state | evidence (exact DOM text).
    Stop at first reliable repro and give me the minimal step list.
    

    The one-factor-at-a-time instruction matters — it converts flailing into an experiment design, and the minimal repro is what makes the eventual defect report filed-quality.

  5. Draft specs from the live session. Once a flow or repro is understood, have the model write the test from what it actually saw:

    Write a Playwright spec for the recovered-submit bug above. Use getByRole/getByLabel
    locators taken from the page you just drove — do not invent selectors. Assert the
    user-visible outcome (button re-enabled, form submittable), not internal state.
    

    Then prove the draft honestly: run it, and confirm it fails on the broken build and passes once the bug is fixed (or vice versa for regression specs).

    npx playwright test tests/signup-resubmit.spec.ts --repeat-each=3
    
  6. Close the session with a debrief. Ask for a summary against the charter: areas covered, areas not reached, verified findings, and what a follow-up session should target. File verified bugs through your defect-report workflow.

Key Takeaway:

MCP gives the model hands, not judgment. Every finding is a claim until you reproduce it; every drafted spec is a guess until it fails on the broken build. The charter, the steering, and the verification pass are where the QA actually happens.

Variations

  • Copilot / Cursor MCP: identical server, different host — useful when the team lives in VS Code; session transcripts land in the chat panel for the session sheet.
  • Headed vs headless: run headed (--headless off) while you are learning to steer — watching the browser move teaches you what the model misunderstands.
  • Trace-backed sessions: launch with tracing on so every AI-driven action is replayable in the Playwright trace viewer — the strongest evidence attachment a repro can carry.
  • Scheduled smoke tour: a scripted nightly MCP sweep of critical flows with an anomaly report each morning — cheap early warning, but findings still route through human verification.

Quality check

  • Charter discipline: each session has a written charter and timebox; the debrief maps findings to it.
  • Verification ledger: every reported anomaly marked verified/not-reproducible/by-design by a human before filing.
  • No invented selectors: drafted specs use locators quoted from session snapshots; spot-check against the DOM.
  • Honest spec proof: new specs demonstrated to fail on the broken state, not just pass on the healthy one.
  • Credential hygiene: session used seeded test accounts only; no production URLs in the transcript.

Pitfalls

  • Believing the model's severity calls. It cannot know your users or your risk model; its severity is a guess and labeled as such.
  • Unscoped wandering. "Explore the app" produces a shallow tour of everything and insight into nothing. Charter per session, one risk area at a time.
  • Accessibility-tree blindness. Invisible-to-AT bugs — overlap, z-index, contrast — will not surface. Pair MCP sweeps with visual checks for UI-heavy releases.
  • Session-as-regression-suite. Interactive sessions are exploration; re-running yesterday's transcript is not CI. Promote what matters into committed specs.
  • Two-tab account clobbering. The model happily logs the same seeded user in twice and corrupts its own repro state — give it distinct accounts when parallel sessions matter.

Restricted-environment variant

An MCP session streams page content — DOM text, user data on screen — to the model provider. On client work, treat that as data egress: use only client-approved assistants, run against synthetic-data test environments, and keep client production URLs and real customer records out of sessions entirely. Where policy demands local-only, host the model via Ollama with an MCP-capable client; steering quality drops, so tighten charters and expect more verification work.

Success criteria

  • Exploratory sessions produce verified, filed bugs per hour at a rate manual-only sessions did not — with session sheets to prove coverage.
  • At least one "sometimes" ticket converted into a minimal, reliable repro via a factor-isolation session.
  • Specs drafted from sessions merge with real locators and honest fail-on-broken proof.
  • Zero production credentials or customer data in any session transcript.
Pro Tip

Save your best session prompts — the signup-abuse charter, the one-factor repro template — into the team prompt library. A well-worded charter is reusable test IP; the session it drives is disposable.

This is the free reading view. Open BXUP to track your progress, run the hands-on labs, and prove it with original, exam-pattern assessments.
© Anvi Innovate · BXUP — Be Exponentially Upskilled · BXUP is an independent learning platform, not affiliated with or endorsed by AWS, Microsoft, Google, NVIDIA, IBM, Salesforce, Databricks, Oracle or Anthropic. All trademarks belong to their respective owners. · bxup.in