Control Chrome browser from the terminal. Open pages, click buttons, type text, take screenshots, extract content, upload files, save PDFs. Use for web automation, social media posting, screenshot generation, form filling, and web scraping.
Control Google Chrome programmatically from Claude Code. No API keys required.
Before using any browser command, Chrome must be running with remote debugging:
# Use your own Chrome (all your logins, bookmarks, tabs restored):
node ~/.claude/tools/browser-agent/browser.js launch --own-profile
# OR use an isolated clean profile (no logins):
node ~/.claude/tools/browser-agent/browser.js launch
The flag is the default recommended mode. WARN THE USER before running this as it will:
--own-profileRun this once per session. If Chrome is already running with debugging, it just connects.
All commands use this format:
node ~/.claude/tools/browser-agent/browser.js <command> [args]
browser launch # Start Chrome with remote debugging
browser list # List all open tabs with indices
browser open <url> [--new-tab] # Navigate to URL
browser close <tab> # Close a tab
browser click <tab> "<text or css>" # Click element by text content or CSS selector
browser type <tab> "<text>" [--selector "<css>"] [--enter] # Type into focused/specified element
browser elements <tab> # List all interactive elements (links, buttons, inputs)
browser scroll <tab> [up|down] # Scroll the page
browser wait <tab> <ms> # Wait for content to load
browser upload <tab> "<selector>" "<file>" # Upload a file to a file input
browser screenshot <tab> [-o path] [--full] [--width N] [--height N] [--selector ".css"]
browser content <tab> # Extract text content (no HTML)
browser html <tab> # Get raw HTML
browser pdf <tab> [-o path] # Save page as PDF
node ~/.claude/tools/browser-agent/browser.js launch
node ~/.claude/tools/browser-agent/browser.js open x.com --new-tab
node ~/.claude/tools/browser-agent/browser.js elements 0 # Find the compose button
node ~/.claude/tools/browser-agent/browser.js click 0 "Post" # Or whatever the compose trigger is
node ~/.claude/tools/browser-agent/browser.js type 0 "Your post text here" --selector "[data-testid='tweetTextarea_0']"
node ~/.claude/tools/browser-agent/browser.js click 0 "Post" # Submit
# Open the HTML carousel file
node ~/.claude/tools/browser-agent/browser.js open file:///path/to/carousel.html --new-tab
# Set viewport to Instagram dimensions and screenshot
node ~/.claude/tools/browser-agent/browser.js screenshot 0 --width 1080 --height 1350 -o slide-1.png
# Scroll to next slide and repeat
node ~/.claude/tools/browser-agent/browser.js scroll 0 down
node ~/.claude/tools/browser-agent/browser.js screenshot 0 -o slide-2.png
node ~/.claude/tools/browser-agent/browser.js open "https://example.com" --new-tab
node ~/.claude/tools/browser-agent/browser.js content 0
node ~/.claude/tools/browser-agent/browser.js elements 0 # List all form fields
node ~/.claude/tools/browser-agent/browser.js type 0 "John" --selector "#firstName"
node ~/.claude/tools/browser-agent/browser.js type 0 "[email protected]" --selector "#email"
node ~/.claude/tools/browser-agent/browser.js click 0 "Submit"
browser list to see which tab is which.browser launch first — it won't connect to a regular Chrome window.click command tries CSS selector first, then falls back to text matching.--width and --height.--full flag on screenshot captures the entire scrollable page.browser wait <tab> 2000 after navigation to let dynamic content load.~/.claude/tools/browser-agent/chrome-profile/ — it won't affect your regular Chrome.For convenience, you can create an alias:
alias browser="node ~/.claude/tools/browser-agent/browser.js"