Skip to content

stevez/playwright-repl

Repository files navigation

playwright-repl

playwright-repl

Keyword-driven browser automation powered by Playwright. Use it from VS Code, your terminal, as a Chrome extension, or let an AI agent drive it via MCP.

pw> goto https://demo.playwright.dev/todomvc/
pw> fill "What needs to be done?" Buy groceries
pw> press Enter
pw> snapshot
pw> click e5
pw> verify text 1 item left

Instead of writing page.locator('[placeholder="What needs to be done?"]').fill('Buy groceries'), you type fill "What needs to be done?" Buy groceries. Same Playwright engine, simpler syntax.


Packages

Package Description
Playwright REPL VS Code extension — Test Explorer, REPL panel, assert builder, element picker
playwright-repl CLI — terminal REPL with keyword commands, recording, replay, and piping
Dramaturg Chrome extension — console, script editor, recorder, JS debugger
@playwright-repl/runner Test runner — drop-in replacement for npx playwright test with context reuse
@playwright-repl/mcp MCP server — AI agents control your real Chrome browser
@playwright-repl/core Shared parser, servers, and utilities

VS Code Extension

Test Explorer, interactive REPL, assert builder, and element picker — all inside VS Code.

Feature Description
Test Explorer Run Playwright tests with persistent browser and context reuse
REPL Panel Interactive commands, inline screenshots, execution timing
Locator Panel Pick elements visually, highlight toggle, ARIA snapshot
Assert Builder 13 matchers, smart filtering by element type, verify against live page
Recorder Capture interactions as .pw keyword commands or Playwright JavaScript

Workflow: Record → Pick Locator → Assert → Run Test

Full VS Code extension docs


CLI

Terminal REPL for Playwright. Supports keyword commands and JavaScript.

npm install -g playwright-repl
playwright-repl
pw> goto https://demo.playwright.dev/todomvc/
pw> fill "What needs to be done?" Buy groceries
pw> press Enter
pw> await page.title()
pw> verify text 1 item left
pw> screenshot

Two modes:

Mode Flag How it works
Standalone (default) Launches Chromium with Dramaturg extension
Bridge --bridge Connects to your real Chrome via Dramaturg extension

Standalone launches a fresh Chromium with the extension pre-installed — keyword commands and JavaScript both work. Use --headless for CI/scripting.

Full CLI docs


pw Commands

The @playwright-repl/runner package provides the pw CLI:

npm install -D @playwright-repl/runner
pw test                              # run Playwright tests (2.8x faster via extension)
pw repl                              # interactive REPL with keyword + JS support
pw repl --headless                   # headless mode for scripting

Full runner docs


Dramaturg — Chrome Extension

Chrome side panel extension that runs Playwright directly inside your browser.

Install from the Chrome Web Store, or build from source.

Feature
Console .pw keywords and Playwright JavaScript — auto-detected
Script editor Syntax highlighting, pass/fail gutter, autocompletion
JS debugger Breakpoints, step over/into/out, variables with scope inspection
Recorder Captures interactions as .pw commands and Playwright code
Object tree Expandable CDP object tree

Full extension docs


MCP Server — AI Browser Agent

AI agents control the browser — standalone or connected to your real Chrome.

npm install -g @playwright-repl/mcp
playwright-repl-mcp --standalone     # launch fresh browser (keyword + JS)
playwright-repl-mcp                  # connect to existing Chrome via bridge
@playwright-repl/mcp Playwright MCP Playwriter
Uses your real session Yes No Yes
expect() assertions Yes No No
Full Playwright API Yes Yes Yes
JS eval (page.evaluate) Yes No Yes

Full MCP docs


Monorepo Structure

packages/
├── vscode/         # Playwright REPL — VS Code extension
├── cli/            # playwright-repl — terminal REPL
├── runner/         # @playwright-repl/runner — test runner (pw CLI)
├── extension/      # Dramaturg — Chrome side panel extension
├── mcp/            # @playwright-repl/mcp — MCP server for AI agents
└── core/           # @playwright-repl/core — shared parser, servers, utilities

Requirements

  • Node.js >= 20
  • Playwright >= 1.59

License

MIT

About

Interactive REPL for Playwright browser automation with record & replay

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors