Headless Playwright browser extension for pi.
This extension makes browser automation a first-class pi capability with a persistent headless browser session and browser-specific tools:
browser_navigatebrowser_snapshotbrowser_clickbrowser_typebrowser_press_keybrowser_wait_forbrowser_evaluatebrowser_consolebrowser_networkbrowser_screenshotbrowser_video_startbrowser_video_stopbrowser_video_statusbrowser_run_summarybrowser_tabsbrowser_close
It also adds these commands:
/browser/browser-open <url>/browser-reset/browser-close/browser-video-start/browser-video-stop/browser-clean
From this directory:
npm installThen load it from pi:
pi -e /absolute/path/to/pi-playwright-extensionOr add it to your pi package list/settings.
This repo is intended for git-based installation in pi.
pi install git:github.com/SamuelLHuber/pi-playwright-extensionTo pin a tag or commit:
pi install git:github.com/SamuelLHuber/pi-playwright-extension@<tag-or-commit>If your environment already has GitHub SSH access configured:
pi install git:git@github.com:SamuelLHuber/pi-playwright-extension.gitOr pinned:
pi install git:git@github.com:SamuelLHuber/pi-playwright-extension.git@<tag-or-commit>If you prefer to keep the repo checked out locally:
git clone git@github.com:SamuelLHuber/pi-playwright-extension.git
cd pi-playwright-extension
npm install
pi -e .To install it only for the current project:
pi install -l git:github.com/SamuelLHuber/pi-playwright-extensionThis extension takes inspiration from Playwright MCP, but presents a pi-native tool surface instead of exposing a generic MCP bridge. The main goal is reliable headless webpage testing with a stable browser session across turns.
- Headless by default
- Chromium by default
- Persistent browser session within the current pi session
- Browser reset on pi session switch, fork, or tree navigation
- Snapshot output includes stable element refs for later clicks and typing
- Screenshots and finalized video artifacts are written to the output directory
- Video recording can be enabled per session or at startup
- Artifact cleanup is handled by the extension using retention settings
- A consolidated run summary can bundle screenshot, video, logs, and a markdown report
--browser-headless- defaults totrue--browser-engine-chromium,firefox, orwebkit--browser-output-dir- defaults to.pi/browser--browser-storage-state- optional Playwright storage state JSON file--browser-viewport- defaults to1440x960--browser-record-video- defaults tofalse--browser-video-size- defaults to1440x960--browser-retention-max-artifacts- defaults to50--browser-retention-max-bytes- defaults to536870912(512MB)--browser-retention-max-days- defaults to7--browser-timeout-action- defaults to5000--browser-timeout-navigation- defaults to30000
browser_navigatebrowser_snapshotbrowser_click/browser_typeusing returned refsbrowser_wait_forbrowser_console/browser_networkwhen debuggingbrowser_screenshotwhen a file artifact is neededbrowser_video_startbefore a flow andbrowser_video_stopafter it when you want a full replay artifactbrowser_run_summaryat the end when you want one bundled artifact block with screenshot, video paths, diagnostics, and a markdown report/browser-cleanwhen you want to force pruning immediately
npm run check
npm testArtifacts are written into the browser output directory, which defaults to .pi/browser.
The extension owns cleanup. When it writes screenshots, videos, or summary artifacts, it prunes old files using the configured retention policy.
Cleanup controls:
--browser-retention-max-artifacts--browser-retention-max-bytes--browser-retention-max-days/browser-clean
This keeps browser output from growing without bound while still preserving recent evidence for debugging.
browser_run_summary is an end-of-run packaging tool.
It can:
- capture a final screenshot
- optionally finalize active video recording
- include console output
- include network output
- optionally include a fresh browser snapshot
- write a markdown summary artifact
- return the key artifact paths in one compact tool result
Use it when the user asks for a report, evidence, or a bundled summary of a browser run.
The test suite launches a real headless Chromium instance against a local HTTP server and verifies:
- navigation
- snapshot generation
- stable refs
- typing and clicking
- console capture
- network capture
- tab management
- video recording and artifact finalization
- bundled run summary generation
- artifact cleanup
- extension registration
- Optimized for headless automation, not interactive desktop browsing.
- Snapshot refs are intended to be used soon after
browser_snapshot; page changes can invalidate them. - Video recording recreates the browser context to ensure clean recordings.
- Browser state is intentionally reset on pi session switch, fork, and tree navigation.