mobitru-playwright-cli
v1.0.0
Published
Mobitru Playwright CLI — command-line tool for AI agents to automate browser testing on Mobitru cloud
Maintainers
Readme
mobitru-playwright-cli
CLI for AI agents to automate browser testing through the Mobitru cloud platform.
Thin wrapper over @playwright/cli with Mobitru-specific session plumbing. Drives a remote browser on Mobitru cloud — Chromium, Chrome, Firefox, or WebKit. No local browser required.
Installation
npm install -g mobitru-playwright-cli⚠️ npm only. The package uses a
postinstallscript to patch@playwright/cliinnode_modules/. Alternative managers — pnpm, yarn (PnP), bun — use symlink farms or virtual filesystems and the patch silently fails.
Quick start
# 1. Configure once
mobitru-playwright-cli config --set baseUrl=app.mobitru.com
mobitru-playwright-cli config --set apiKey=mobitru_ak_...
mobitru-playwright-cli config --set slug=your-slug
mobitru-playwright-cli config --set browserHubBaseUrl=browserhub.mobitru.com
# 2. Automate
mobitru-playwright-cli start https://example.com
mobitru-playwright-cli snapshot
mobitru-playwright-cli fill e1 "[email protected]"
mobitru-playwright-cli click e3
mobitru-playwright-cli screenshot
mobitru-playwright-cli closeConfiguration
Credentials are resolved in order: env vars → ~/.mobitru-cli/config.json.
| Field | Env var | Description |
|---|---|---|
| baseUrl | DEVICE_FARM_BASE_URL | Mobitru REST API host |
| browserHubBaseUrl | DEVICE_FARM_BROWSER_HUB_BASE_URL | Browser Hub endpoint |
| apiKey | DEVICE_FARM_API_KEY | API key (mobitru_ak_...) |
| slug | DEVICE_FARM_SLUG | Billing/workspace slug |
mobitru-playwright-cli config # inspect resolved credentialsSession lifecycle
mobitru-playwright-cli start # allocate Chromium (default)
mobitru-playwright-cli start https://example.com # allocate and navigate
mobitru-playwright-cli start --browser=firefox # chromium | chrome | firefox | webkit
mobitru-playwright-cli start --no-video # disable cloud-side recording
mobitru-playwright-cli close # release cloud slot (always do this)
mobitru-playwright-cli close-all # sweep all sessions
mobitru-playwright-cli kill-all # force-kill stale daemonsstart prints JSON to stdout — save sessionId for download-recording:
{ "sessionName": "mobitru", "sessionId": "abc-123", "artifactDir": "/path/to/.mobitru-playwright-cli" }Parallel sessions
The default session name is mobitru. Use -s <name> (root-level flag) to run multiple independent cloud browsers simultaneously. Each session has its own daemon, cloud slot, and browser context.
# Terminal 1
mobitru-playwright-cli -s run-1 start https://site-a.com
# Terminal 2
mobitru-playwright-cli -s run-2 start https://site-b.com
# Commands are session-scoped
mobitru-playwright-cli -s run-1 snapshot
mobitru-playwright-cli -s run-2 snapshot
mobitru-playwright-cli -s run-1 close
mobitru-playwright-cli -s run-2 closeDifferent -s names are sufficient — each session gets its own daemon socket (<workspaceHash>-<sessionName>.sock), so run-1 and run-2 never collide regardless of working directory.
Commands
Navigation
goto <url> | go-back | go-forward | reloadInspection
snapshot [ref] [--filename=out.yml] [--depth=4]
screenshot [ref] [--full-page] [--filename=out.png]
pdf [--filename=out.pdf]
console [level] [--clear]
network [--filter=<pattern>] [--request-body] [--clear]
eval "() => document.title"Interaction
click <ref> [button] [--modifiers=Shift,Control]
dblclick <ref> | hover <ref>
fill <ref> <text> [--submit]
type <text> [--submit]
drag <ref> <ref>
select <ref> <value>
check <ref> | uncheck <ref>
press <key> | keydown <key> | keyup <key>
upload <path>
resize <width> <height>Tabs
tab-list | tab-new | tab-select <index> | tab-close [index]Storage & state
state-save [file] | state-load <file>
cookie-list | cookie-get <name> | cookie-set <name> <value> | cookie-delete <name> | cookie-clear
localstorage-list | localstorage-get <key> | localstorage-set <key> <value>
sessionstorage-list | sessionstorage-get <key> | sessionstorage-set <key> <value>Network
route <pattern> [--status=404] [--body=...] [--content-type=...]
route-list | unroute [pattern]
network-state-set offline | network-state-set onlineTracing & video
tracing-start | tracing-stop
video-start [file] [--size=1280x720] | video-stopCloud diagnostics
stats # hub capacity (total / free / used)
download-recording <sessionId> [--output=dir] # download cloud MP4 (run after close)Artifacts
Auto-generated files land in the artifact directory — stamped at start, not affected by later CWD changes.
| Setting | Path |
|---|---|
| Default | <CWD>/.mobitru-playwright-cli/ |
| Override | PLAYWRIGHT_MCP_OUTPUT_DIR=/your/path mobitru-playwright-cli start |
Files named with --filename=<path> are resolved relative to CWD at command time, not the artifact dir.
Agent skill
Install the bundled skill so your agent knows how to use the CLI:
mobitru-playwright-cli install --skills=claude # → .claude/skills/mobitru-playwright-cli/
mobitru-playwright-cli install --skills=agents # → .agents/skills/mobitru-playwright-cli/