mcpField
B
browser-automation

browser-automation

github.com/civitaiTesting & quality7.3k82 installsUpdated today
Repository

About browser-automation

browser-automation is a skill for interactive browser work and testing, intended for teams that need repeatable page flows or multi-user scenarios. It exposes HTTP endpoints to manage sessions, authentication profiles, and reusable Playwright flows.

Key features

  1. 01Create and manage browser sessions
  2. 02Save and use authentication profiles
  3. 03Record and run reusable flows
  4. 04Execute Playwright page code
  5. 05Inspect page state and screenshots

Use cases

  1. 01Test pages with different user permissions
  2. 02Rerun saved browser flows
  3. 03Compare local mockups with live pages

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/civitai/civitai --skill browser-automation

After installing, type/browser-automationin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

package-lock.json
package.json
server.mjs

Details

From the project README

Browser Automation Skill

Explore pages interactively, build reusable flows, and test multi-user scenarios.

Quick Start

# Start server
node .claude/skills/browser-automation/server.mjs &

# Check available profiles
curl http://localhost:9222/profiles

# Create a session
curl -X POST http://localhost:9222/sessions \
  -d '{"name": "test", "url": "http://localhost:3000", "profile": "member"}'

# Inspect the page
curl http://localhost:9222/inspect

# Execute code
curl -X POST http://localhost:9222/chunk \
  -d '{"label": "Click button", "code": "await page.click(\"button.submit\");"}'

# Shutdown
curl -X POST http://localhost:9222/exit

Endpoints

EndpointMethodDescription
/profilesGETList auth profiles with descriptions
/sessionsGETList active sessions
/sessionsPOSTCreate session { name, url, profile?, headless? }
/sessions/:nameDELETEClose session
/flowsGETList saved flows
/flows/:name/runPOSTRun flow { profile?, startUrl?, headless? }
/statusGETSession status
/inspectGETPage state + screenshot. Add ?fullPage=true for full-page screenshot
/chunkPOSTExecute code { label, code }
/navigatePOSTNavigate { url, fullPage? }. Set fullPage: true for full-page screenshot
/save-authPOSTSave auth { profile, description }
/reviewGETReview recorded chunks
/exitPOSTShutdown server

Use ?session=name when multiple sessions are active.

Multi-User Testing

# Create two sessions with different profiles
curl -X POST http://localhost:9222/sessions \
  -d '{"name": "creator", "url": "http://localhost:3000", "profile": "creator"}'
curl -X POST http://localhost:9222/sessions \
  -d '{"name": "viewer", "url": "http://localhost:3000", "profile": "member"}'

# Creator does something
curl -X POST "http://localhost:9222/chunk?session=creator" \
  -d '{"label": "Publish", "code": "await page.click(\"button.publish\");"}'

# Viewer sees it
curl -X POST "http://localhost:9222/navigate?session=viewer" \
  -d '{"url": "http://localhost:3000/models"}'

Profiles

# List profiles
curl http://localhost:9222/profiles

# Create new profile (description required)
curl -X POST http://localhost:9222/save-auth \
  -d '{"profile": "moderator", "description": "User with mod permissions"}'

# Refresh existing profile
curl -X POST http://localhost:9222/save-auth \
  -d '{"profile": "moderator"}'
ProfileDescription
moderatorMod permissions for content review
creatorEstablished user with published content
memberStandard logged-in user
new-userFresh account for onboarding flows

Flows

Saved flows are reusable Playwright scripts.

# List flows
curl http://localhost:9222/flows

# Run a flow
curl -X POST http://localhost:9222/flows/my-flow/run \
  -d '{"profile": "member"}'

# Run with custom start URL
curl -X POST http://localhost:9222/flows/my-flow/run \
  -d '{"profile": "member", "startUrl": "http://localhost:3000"}'

Flows are stored in .browser/flows/*.js.

Playwright Code

Chunks execute with page available:

await page.click('button.submit');
await page.fill('input[name="email"]', '[email protected]');
await page.waitForSelector('h1');
await page.goto('https://example.com');
const title = await page.textContent('h1');

Mockup Comparison

Open local HTML mockups with file:// URLs, then compare to live pages:

# 1. Open mockup and take full-page screenshot
curl -X POST http://localhost:9222/sessions \
  -d '{"name": "compare", "url": "file:///C:/path/to/mockup.html"}'
curl "http://localhost:9222/inspect?session=compare&fullPage=true"

# 2. Navigate to live page and screenshot
curl -X POST "http://localhost:9222/navigate?session=compare" \
  -d '{"url": "http://localhost:3000/page", "fullPage": true}'

# 3. Compare screenshots in session folder

File Locations

  • Flows: .browser/flows/*.js
  • Profile metadata: .browser/profiles/profiles.meta.json
  • Auth state: .browser/profiles/*.json (gitignored)
  • Screenshots: .browser/sessions/{id}/screenshots/

Comments

Markdown supported