browser-automation
Automate real browsers for testing and scraping — Playwright-first flows, selector strategy, waiting discipline, and anti-flake patterns.
Skill by xanstomper
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/xanstomper-browser-automation
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: testing, writing, productivity
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/browser-automation
What's inside
- Skill name
browser-automation- Description
- Automate real browsers for testing and scraping — Playwright-first flows, selector strategy, waiting discipline, and anti-flake patterns. Use when writing E2E tests, scraping a JS-rendered site, taking screenshots, or automating any browser workflow.
- License
- MIT
- Instructions
- 74 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
# Browser Automation Procedure
Flaky automation is worse than no automation. The discipline is: stable selectors, explicit waits, and deterministic data.
## 1. Playwright first (choose the tool by need)
- Playwright: multi-browser, auto-waiting, best-in-class network control — the default for tests and automation.
- Puppeteer: fine for Chrome-only scraping. Raw CDP: only when driving an already-running browser via the DevTools protocol.
- Never Selenium for new work — every capability it has, Playwright supersedes.
## 2. Selector strategy (in strict order of preference)
- `getByRole('button', { name: 'Submit' })` / `getByLabel` — accessible semantics survive redesigns and assert a11y for free.
- `getByText` for content; data-testid LAST (it's a contract you must maintain); CSS/XPath chains never (they encode layout, which changes).
- If a role selector can't find it, that's a finding: the element probably isn't accessible. Fix the markup, not the selector.
## 3. Waiting discipline (the anti-flake core)
- Auto-waiting is the default: Playwright's locators wait for actionable states. Never `waitForTimeout(3000)` — a hardcoded sleep is a race condition dressed as a fix.
- Wait for SIGNALS not durations: `expect(locator).toBeVisible()`, `waitForURL`, `waitForResponse` on the specific API call the UI triggers.
- Network-dependent flows: route/fulfill the API (mock at the protocol level) rather than waiting for real backends.
## 4. Determinism requirements
- Fixed data: seed the database or intercept APIs; tests must not depend on "a user named X exists" from a prior run.
- Timezone/locale pinned (`TZ=UTC`, fixed clock via `page.clock`); animations disabled (`reducedMotion: 'reduce'`); fonts preloaded before screenshot assertions.
- Parallel-safe: no test mutates shared state another test reads. One browser context per test (free isolation).
## 5. Verification patterns
- Assertions over screenshots for behavior; visual snapshots for REGRESSION (compare against baseline, not truth-from-scratch).
- Screenshots: full-page for layout review, element-scoped for components. Record video/trace on failure (`trace: 'on-first-retry'`) — the trace viewer is the debugger.
- Scrape flows: respect robots.txt and rate limits, cache raw HTML before parsing, and re-verify selectors monthly (sites rot).
## Pitfalls
- Testing through the UI what you could test via API: UI tests are for the INTEGRATION, not for data setup — seed via API/DB, act via UI, assert via UI.
- `page.$eval` one-offs that bypass locator retry semantics — the API you reach for determines your flake rate.
- Forgetting downloads/popups open new pages: the context listener must be registered BEFORE the triggering click.
## 6. Driving mochi's built-in `browser` tool instead
For ad-hoc automation (not test suites), mochi's own `browser` tool wraps a
persistent-profile driver. What survives across calls: cookies/localStorage
(via a storageState snapshot per profile — Chromium alone drops session
cookies) and the open TAB SET. What does NOT: unsubmitted page state —
pages reopen from their URLs, so typed-but-unsent form fields are lost
between calls. Consequences:
- Profiles: the `profile` arg is a NAME (slugs only; directory paths are
refused — a profile is a credential store). `profiles` lists them,
`revokeprofile` destroys a profile's logins, `forgetprofile` clears a
revoked name. Reuse the same name to resume a login; first use mints
the profile and the result says so. A result warning about an
`ephemeral` fallback means that call's logins did NOT persist.
- Multi-action flows are ONE `batch` call: `command=batch` with
`js='[{"command":"fill","args":["#user","alice"]}, …]'` — steps run in
one live session and stop at the first failure. Single calls are for
navigation, reads, and one-shot actions. `tabs` lists the tab set,
`newtab [url]` opens one, `switchtab <index|url-part>` changes the
active tab, `closetab` removes one.
- Reading: `extract [css]` returns main content as clean markdown plus
the largest table as structured rows. `a11y [css]` returns the
accessibility tree (roles/names/states) — more stable than DOM scrapes
on dynamic pages. `netlog [n|clear]` returns the session's request log
(method/URL/status) for verifying an action actually hit the API.
- Waiting: `waitfor` takes a selector, a load state (`networkidle`,
`load`, `domcontentloaded`), `url:<part>`, `response:<url-part>` (the
fetch a click triggers — wait for IT, not the DOM),
`<css>::state:<visible|hidden|enabled|disabled>`, or
`<css>::text:<substr>`. Waits are signal-shaped (per §3): wait for the
signal the next step needs, never a bare `waitMs`.
- Frames and files: pass `frame` (iframe selector or name) to act inside
an iframe (payment widgets); `upload <css> <path>` sets a file input;
`download <css> [dest]` clicks a trigger and saves the resulting
download — the tool registers the wait before the click, so the §5
popup/download race is handled.
- Console errors and page errors ride along in every result — treat them
as verification evidence, per the `mochi-automation-surface` skill's
assert-the-effect rule.From xanstomper/mochi, MIT.
More from xanstomper/mochi
- 0.587score
accessibility-audit
xanstomper
Audit and fix accessibility (a11y) — WCAG 2.2 AA compliance, screen-reader flows, keyboard navigation, and ARIA correctness for web apps.
SkillAFreshness: A★ 1Claude Code +9 - 0.587score
api-backwards-compatibility
xanstomper
Change APIs without breaking existing clients — deprecation windows, additive changes, and safe removal.
SkillAFreshness: A★ 1Claude Code +9 - 0.587score
api-design
xanstomper
Design public APIs and CLIs — naming, ergonomics, versioning, error surfaces, and backward-compat discipline.
SkillAFreshness: A★ 1Claude Code +9 - 0.587score
api-integration
xanstomper
Integrate third-party APIs correctly — auth patterns, retry/backoff, pagination, rate limits, idempotency, and contract testing.
SkillAFreshness: A★ 1Claude Code +9 - 0.587score
api-security-hardening
xanstomper
Secure web APIs and backends — authz enforcement, injection prevention, rate limiting, secret handling, and the OWASP-class checks that block real attacks.
SkillAFreshness: A★ 1Claude Code +9 - 0.587score
api-versioning
xanstomper
Evolve APIs without breaking clients — additive change first, deprecation windows, compatibility shims, and migration paths.
SkillAFreshness: A★ 1Claude Code +9 - 0.587score
async-concurrency
xanstomper
Design correct async and concurrent code — bounded parallelism, backpressure, cancellation, and deadlock avoidance.
SkillAFreshness: A★ 1Claude Code +9 - 0.587score
auth-implementations
xanstomper
Implement authentication correctly — session/JWT/OAuth/SSC flows, password handling, MFA, and the failure modes that become breaches.
SkillAFreshness: A★ 1Claude Code +9 - 0.587score
benchmark-methodology
xanstomper
Honest benchmarking with TTFF/TTFI/PSS probes — cold start, token throughput, prompt-to-first-token.
SkillAFreshness: A★ 1Claude Code +9 - 0.587score
caching-strategy
xanstomper
Design caching layers — HTTP caching, CDN, application memory caches, invalidation patterns, and cache-coherence reasoning.
SkillAFreshness: A★ 1Claude Code +9 - 0.587score
chaos-engineering
xanstomper
Prove a system survives failure by injecting it deliberately — game days, fault injection, and steady-state hypotheses.
SkillAFreshness: A★ 1Claude Code +9 - 0.587score
checkpoint-semantics
xanstomper
Git-backed checkpoints and rollback composition — naming, nesting, conflicts, when to auto-commit.
SkillAFreshness: A★ 1Claude Code +9
Signals
- Stars
- 1
- Forks
- 2
- Open issues
- 6
- Last commit (this folder)
- Oct 22, 2026 (6 days ago)
- Last release
- Oct 23, 2026 (5 days ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/xanstomper/mochi
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from xanstomper
- 0.587score
api-backwards-compatibility
xanstomper
Change APIs without breaking existing clients — deprecation windows, additive changes, and safe removal.
SkillAFreshness: A★ 1Claude Code +9 - 0.587score
api-design
xanstomper
Design public APIs and CLIs — naming, ergonomics, versioning, error surfaces, and backward-compat discipline.
SkillAFreshness: A★ 1Claude Code +9 - 0.587score
api-integration
xanstomper
Integrate third-party APIs correctly — auth patterns, retry/backoff, pagination, rate limits, idempotency, and contract testing.
SkillAFreshness: A★ 1Claude Code +9 - 0.587score
api-security-hardening
xanstomper
Secure web APIs and backends — authz enforcement, injection prevention, rate limiting, secret handling, and the OWASP-class checks that block real attacks.
SkillAFreshness: A★ 1Claude Code +9 - 0.587score
api-versioning
xanstomper
Evolve APIs without breaking clients — additive change first, deprecation windows, compatibility shims, and migration paths.
SkillAFreshness: A★ 1Claude Code +9 - 0.587score
accessibility-audit
xanstomper
Audit and fix accessibility (a11y) — WCAG 2.2 AA compliance, screen-reader flows, keyboard navigation, and ARIA correctness for web apps.
SkillAFreshness: A★ 1Claude Code +9
Cite this page
browser-automation skill. Agent Mart. https://agentmart.dev/skills/xanstomper-browser-automation (last updated 2026-10-24)