Chrome Browser Skill
A8.0Control a persistent Chrome browser for web automation. Uses a stateful "snapshot -> interact" workflow.
Get This Skill on GitHubOverview
name: chrome-browser description: Control a headless Chrome browser to browse, read, and interact with websites. Supports "click", "fill", and "snapshot" commands using element references (e.g., e1).
Chrome Browser Skill
Control a persistent Chrome browser for web automation. Uses a stateful "snapshot -> interact" workflow.
Philosophy
- Browse: Open URLs and take a snapshot.
- Snapshot: Returns a text representation of the page with element references (e.g.,
button "Submit" [e1]). - Interact: Use commands like
click e1orfill e2 "text"to interact. - Persist: The browser session stays open, allowing complex multi-step workflows (login, checkout, etc.).
Usage
1. Browse & Read (Start Here)
Opens URLs and returns an accessibility snapshot with interactive references.
node scripts/browse.js "https://example.com" --snapshot
Output Example:
=== [0] Example Domain ===
heading "Example Domain"
link "More information..." [e1]
2. Interact with Page
Use the references ([eN]) from the snapshot to interact.
# Click a link/button
node scripts/interact.js <tab_index> click <ref>
# Example:
node scripts/interact.js 0 click e1
# Fill a form
node scripts/interact.js 0 fill <ref> "my search text"
3. Re-Snapshot
After interacting (which might change the page), take a new snapshot to see the new state and get new refs.
node scripts/snapshot.js <tab_index>
# Example:
node scripts/snapshot.js 0
4. Manage Tabs
# List open tabs
node scripts/listTabs.js
# Close specific tabs
node scripts/closeTab.js 2 3 5
# Close all tabs (keeps one for reuse)
node scripts/closeTab.js all
# Quit browser entirely
node scripts/quit.js
# Launch browser (if not running)
node scripts/launch.js
Detailed Command Reference
browse.js
Opens URLs.
node scripts/browse.js <url>... [--snapshot] [--close]--snapshot: Prints page content with[eN]refs.--close: Closes tabs after opening (use for one-off reads).
interact.js
Performs actions on elements identified by refs.
click <ref>: Click an element.fill <ref> "value": Fill an input/textarea.scroll <ref>: Scroll element into view.
snapshot.js
Takes a fresh snapshot of an existing tab.
node scripts/snapshot.js <tab_index>
closeTab.js
Closes tabs to clean up after workflows.
node scripts/closeTab.js <index>...: Close specific tabs by index.node scripts/closeTab.js all: Close all tabs except one.
quit.js
Fully closes the browser when done.
node scripts/quit.js: Closes all tabs and shuts down Chrome.
Anti-Patterns
❌ Guessing IDs: Never guess e1. Always read a snapshot first.
❌ Stale Refs: If the page reloads, old refs (e.g., e1) are lost. Take a new snapshot.
❌ Tab Accumulation: Clean up with closeTab.js all or quit.js when done.
Ready to use this skill?
Visit the original repository to get the full skill configuration and installation instructions.
View on GitHub