{"_id":"@arthurfordllc/slapwright","name":"@arthurfordllc/slapwright","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@arthurfordllc/slapwright","version":"1.0.0","description":"Lightning-fast web testing CLI for AI agents. Connect to Chrome via CDP, see the screen with one command, interact with simple tap/type/assert commands.","type":"module","bin":{"slapwright":"dist/slapwright.js"},"scripts":{"build":"esbuild src/index.ts --bundle --platform=node --target=node18 --format=esm --outfile=dist/slapwright.js --banner:js='#!/usr/bin/env node' --external:ws","test":"vitest run","test:watch":"vitest","prepublishOnly":"npm run build"},"keywords":["ai-agent","testing","cli","web-testing","cdp","chrome-devtools-protocol","llm","claude","automation","browser-testing","accessibility","ai-testing","developer-tools","typescript"],"repository":{"type":"git","url":"git+https://github.com/arthurfordllc/slapwright.git"},"homepage":"https://github.com/arthurfordllc/slapwright","bugs":{"url":"https://github.com/arthurfordllc/slapwright/issues"},"license":"MIT","author":{"name":"Arthur Ford, LLC"},"engines":{"node":">=18"},"dependencies":{"ws":"^8.18.0"},"devDependencies":{"@types/node":"^22.0.0","@types/ws":"^8.5.0","esbuild":"^0.20.0","typescript":"^5.4.0","vitest":"^1.6.0"},"gitHead":"25a54c44513800e6a6ae59d3d4923282d7caebe8","_id":"@arthurfordllc/slapwright@1.0.0","_nodeVersion":"25.6.1","_npmVersion":"11.9.0","dist":{"integrity":"sha512-b+lxi6N2LikFdCHSuRRk+zYG2WSnSdW0f1FXff0ELlBZJzZclSufrmff6+tFWqTimqakb/Kgbvn8DSFGRXEOOg==","shasum":"ad526626c0a9eb3d155eaad81c0113e8079a5c0a","tarball":"https://registry.npmjs.org/@arthurfordllc/slapwright/-/slapwright-1.0.0.tgz","fileCount":6,"unpackedSize":48603,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIDO8Jk0p42OvnKsaFgCmWLoIDsQ/e1tdf7XYa0FCWmQwAiEAzeiwZahQ3ObGwMTAgoO5OqB5eoeuhyQu5Ir7Y0ODToU="}]},"_npmUser":{"name":"andygillis","email":"andy@carecoordinate.app"},"directories":{},"maintainers":[{"name":"andygillis","email":"andy@carecoordinate.app"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/slapwright_1.0.0_1772979057232_0.21175541251388896"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-08T14:10:57.095Z","1.0.0":"2026-03-08T14:10:57.416Z","modified":"2026-03-08T14:10:57.708Z"},"maintainers":[{"name":"andygillis","email":"andy@carecoordinate.app"}],"description":"Lightning-fast web testing CLI for AI agents. Connect to Chrome via CDP, see the screen with one command, interact with simple tap/type/assert commands.","homepage":"https://github.com/arthurfordllc/slapwright","keywords":["ai-agent","testing","cli","web-testing","cdp","chrome-devtools-protocol","llm","claude","automation","browser-testing","accessibility","ai-testing","developer-tools","typescript"],"repository":{"type":"git","url":"git+https://github.com/arthurfordllc/slapwright.git"},"author":{"name":"Arthur Ford, LLC"},"bugs":{"url":"https://github.com/arthurfordllc/slapwright/issues"},"license":"MIT","readme":"# Slapwright\n\n**Lightning-fast web testing CLI built for AI agents.**\n\nSlapwright gives AI agents (Claude, GPT, Gemini, or any LLM) a dead-simple interface to interact with web applications. One command to see the screen. One command to click. One command to type. No Playwright dependency, no browser launch overhead, no complex API -- just a CLI that connects to Chrome via CDP and does exactly what you tell it.\n\n```\nslapwright peek        # screenshot + full element tree -- instant understanding\nslapwright tap @login  # click a button by data-testid\nslapwright type @email \"user@example.com\"  # type into an input\n```\n\n## Why This Exists\n\nExisting web testing tools weren't designed for AI agents. Playwright is 50MB+ and requires programmatic usage. Selenium needs driver management. Browser MCP servers are heavy and complex. AI agents need something different:\n\n- **One command = one action.** No setup, no boilerplate, no session management.\n- **`peek` gives you everything.** Screenshot + collapsed accessibility tree in a single call. An AI agent can see the page and know every interactive element instantly.\n- **Auto-wait on every interaction.** Elements not ready yet? Slapwright polls automatically. No `sleep`. No retry loops.\n- **Rich error messages.** When an element isn't found, the error shows you what IS on the page so you can adapt immediately.\n- **Session auto-recovery.** Chrome restarted? WebSocket died? The next command silently reconnects.\n\n## Stats\n\n| Metric | Value |\n|--------|-------|\n| Source files | 6 |\n| Tests | 72 |\n| Bundle size | 38KB |\n| Runtime deps | 1 (`ws`) |\n| Startup time | ~50ms |\n\n## Quick Start\n\n### Prerequisites\n\n- Node.js 18+\n- Chrome running with remote debugging:\n\n```bash\n/Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome \\\n  --remote-debugging-port=9222 \\\n  --user-data-dir=/tmp/chrome-debug-profile &\n```\n\n### Install\n\n```bash\ngit clone https://github.com/arthurfordllc/slapwright.git\ncd slapwright\nnpm install\nnpm run build\n```\n\n### Configure\n\nCopy the example config and edit it:\n\n```bash\ncp slapwright.config.example.json slapwright.config.json\n```\n\nEdit `slapwright.config.json` with your Chrome port, app URL, and login credentials.\n\n### Run\n\n```bash\n./bin/slapwright peek\n```\n\n## Commands\n\n### The Big Three (90% of usage)\n\n```bash\nslapwright peek                          # Screenshot + element tree\nslapwright tap <selector>                # Click element with auto-wait\nslapwright type <selector> <text>        # Clear + type into input\n```\n\n### Navigation\n\n```bash\nslapwright navigate <url>                # Go to URL (relative or absolute)\nslapwright back                          # Browser back\nslapwright reload                        # Reload page\n```\n\n### Interaction\n\n```bash\nslapwright tap <selector>                # Click element\nslapwright type <selector> <text>        # Type into input\nslapwright select <selector> <value>     # Choose dropdown option\nslapwright check <selector>              # Check checkbox\nslapwright uncheck <selector>            # Uncheck checkbox\nslapwright otp <digits>                  # Enter OTP digits into numeric inputs\nslapwright scroll <up|down>              # Scroll one page\nslapwright scroll-to <selector>          # Scroll element into view\n```\n\n### Waiting\n\n```bash\nslapwright wait <selector> [timeout]     # Wait for element visible\nslapwright wait-text \"<text>\" [timeout]  # Wait for text on page\nslapwright wait-gone <selector> [timeout]  # Wait for element gone\nslapwright wait-url <pattern> [timeout]  # Wait for URL to match\nslapwright wait-network [timeout]        # Wait for network idle\n```\n\n### Assertions (exit code 0 = pass, 1 = fail)\n\n```bash\nslapwright assert <selector>             # Visible -> exit 0\nslapwright assert-text \"<text>\"          # Text on page -> exit 0\nslapwright assert-not <selector>         # NOT visible -> exit 0\nslapwright assert-url <pattern>          # URL matches -> exit 0\n```\n\n### Inspection\n\n```bash\nslapwright peek                          # Screenshot + element tree (THE command)\nslapwright tree                          # Element tree only\nslapwright screenshot [name]             # Screenshot only\nslapwright source                        # Full page HTML\nslapwright inspect <selector>            # Element details (tag, role, text, rect, etc.)\nslapwright find \"<text>\"                 # Find elements by text/label/testid\nslapwright console [level]               # Console messages (error/warning/info/debug)\n```\n\n### Session & Auth\n\n```bash\nslapwright session                       # Connect to Chrome (usually automatic)\nslapwright status                        # Check connection\nslapwright login [email] [pass] [otp]    # Full login flow (configurable)\nslapwright chain \"cmd1\" \"cmd2\" ...       # Run commands sequentially, stop on failure\n```\n\n## Selectors\n\nSlapwright supports multiple selector strategies:\n\n| Syntax | Matches | Example |\n|--------|---------|---------|\n| `@testid` | `data-testid` attribute | `@save-btn` |\n| `role:button \"Save\"` | Accessibility role + name | `role:link \"Home\"` |\n| `label:Email` | `aria-label` or `<label>` | `label:Password` |\n| `\"visible text\"` | Text content | `\"Submit\"` |\n| `#id` | Element ID | `#email` |\n| `.class` | CSS class | `.btn-primary` |\n\n## How It Works\n\nSlapwright connects to Chrome's DevTools Protocol (CDP) over WebSocket. No browser binary bundled, no Playwright, no Puppeteer. Just a direct WebSocket connection to a running Chrome instance.\n\n- **Accessibility tree** -- `peek` and `tree` use `Accessibility.getFullAXTree()` to get the real accessibility tree, then collapse generic/presentation nodes into a clean, readable summary (~20-30 lines for a typical page).\n- **Screenshots** -- captured via `Page.captureScreenshot` CDP method.\n- **Element finding** -- uses a flexible selector engine that resolves `@testid`, `role:`, `label:`, text content, `#id`, and `.class` patterns into DOM queries.\n- **Session persistence** -- saves the WebSocket URL to `/tmp/slapwright-session.json` for instant reconnect between commands.\n\n## For AI Agent Developers\n\nIf you're building an AI agent that needs to interact with web applications, Slapwright is designed for you. Here's the typical workflow:\n\n```bash\n# 1. See what's on screen\nslapwright peek\n# -> saves screenshot, prints element tree with all interactive elements\n\n# 2. Interact\nslapwright tap @login-btn\nslapwright type @email \"user@test.com\"\nslapwright type @password \"secret\"\nslapwright tap role:button \"Sign In\"\n\n# 3. Wait for navigation\nslapwright wait-url \"/dashboard\"\n\n# 4. Verify\nslapwright assert-text \"Welcome back\"\n\n# 5. See the new state\nslapwright peek\n```\n\nEvery command is stateless (connects, acts, exits). Exit codes are meaningful (0 = success, 1 = element not found / assertion failed, 2 = error). Output is concise and parseable. This is what AI agents need.\n\n## Tests\n\n```bash\nnpm test          # Run all 72 tests\nnpm run test:watch  # Watch mode\n```\n\n## License\n\nMIT -- see [LICENSE](LICENSE).\n\n## Built by\n\n[Arthur Ford, LLC](https://github.com/arthurfordllc)\n","readmeFilename":"README.md","_rev":"1-a9bbacfc066f132f18895e92d3b04b39"}