Automatisation de Chrome
/SKILLConnectez-vous au navigateur Google Chrome et contrôlez-le à l'aide de agent-browser via le protocole CDP (Chrome DevTools Protocol).
name: chrome-automation
description: Connect to and control Google Chrome browser using agent-browser with CDP (Chrome DevTools Protocol). Use when the user wants to automate their existing Chrome browser, see browser actions in real-time, or needs to control the Chrome instance they're already using. Handles installation, setup, connecting via remote debugging, and all browser automation tasks with live visual feedback.
allowed-tools: Bash(*)
Chrome Browser Automation with Real-time Control
Control the user's Google Chrome browser using agent-browser connected via Chrome DevTools Protocol (CDP). All actions are visible in real-time in the user's browser window.
⚠️ CRITICAL: Automatic Installation & Dependency Check
BEFORE using this skill, ALWAYS run the auto-installation check:
This skill automatically checks and installs all required dependencies without user confirmation. The installation process verifies:
- agent-browser repository and binary
- Node.js and pnpm
- Playwright Chromium
- Rust toolchain (cargo)
- Native binary compilation
Auto-installation workflow:
# Mac: Run auto-install script
bash ~/.claude/skills/chrome-automation/scripts/auto-install-mac.sh
# Windows: Run auto-install script (PowerShell)
powershell -ExecutionPolicy Bypass -File "$HOME\.claude\skills\chrome-automation\scripts\auto-install-windows.ps1"The script will:
- Check if agent-browser binary exists and works
- Install missing dependencies automatically (pnpm, Rust, etc.)
- Clone repository if not present
- Build native binary with proper Rust toolchain
- Verify installation success
Critical rules:
- ❌ DO NOT fall back to using built-in browser tools (browserusedesktop)
- ✅ MUST run auto-install script before any browser automation
- ✅ Only proceed with browser automation AFTER successful installation
- ✅ Script handles all dependency checks automatically
Why agent-browser is required:
- Provides real-time visual feedback in user's actual Chrome browser
- Allows user to see and interact with automation in progress
- Offers precise element selection and interaction capabilities
- Built-in browser tools are NOT a substitute for this skill's functionality
Quick Start
First-time setup (automatic)
Run the auto-install script first:
# Mac
bash ~/.claude/skills/chrome-automation/scripts/auto-install-mac.sh
# Windows (PowerShell)
powershell -ExecutionPolicy Bypass -File "$HOME\.claude\skills\chrome-automation\scripts\auto-install-windows.ps1"The script automatically handles:
- Repository cloning
- Dependency installation (pnpm, Playwright)
- Rust toolchain setup
- Native binary compilation
Connect and control Chrome
IMPORTANT: Use the start-chrome script to preserve login states across sessions
# Mac: Start Chrome with persistent profile (RECOMMENDED)
# This preserves your login states, cookies, and settings
bash ~/.claude/skills/chrome-automation/scripts/start-chrome-mac.sh
# Windows: Start Chrome with persistent profile (PowerShell)
powershell -ExecutionPolicy Bypass -File "$HOME\.claude\skills\chrome-automation\scripts\start-chrome-windows.ps1"
# Use agent-browser with --cdp flag
cd /Users/jyxc-dz-0100272/Documents/agent-browser
AGENT_BROWSER_HOME=/Users/jyxc-dz-0100272/Documents/agent-browser \
./bin/agent-browser --cdp 9222 snapshot -iWhat the start-chrome script does:
- First run: Creates a dedicated automation profile at
~/Library/Application Support/Google/Chrome-Automation - First run: Imports your existing Chrome configuration (login states, cookies, settings)
- Subsequent runs: Uses the existing automation profile - all your logins are preserved
- You only need to log in once - it will be remembered for future sessions
Core Workflow
CRITICAL: Always show browser state to user after each significant action using screenshots.
- Connect: Ensure Chrome running with remote debugging port 9222
- Navigate: Open pages using
--cdp 9222flag - Snapshot: Get interactive elements with
snapshot -i - Interact: Use element refs (@e1, @e2, etc.)
- Screenshot: Capture state and show to user
- Report: Describe what's visible in browser
Standard operation pattern
# Set path variables
export AB_HOME=/Users/jyxc-dz-0100272/Documents/agent-browser
cd $AB_HOME
# Navigate
AGENT_BROWSER_HOME=$AB_HOME ./bin/agent-browser --cdp 9222 open https://example.com
sleep 2
# Get interactive elements
AGENT_BROWSER_HOME=$AB_HOME ./bin/agent-browser --cdp 9222 snapshot -i
# Screenshot to show user
AGENT_BROWSER_HOME=$AB_HOME ./bin/agent-browser --cdp 9222 screenshot /tmp/state.png
# Interact
AGENT_BROWSER_HOME=$AB_HOME ./bin/agent-browser --cdp 9222 fill @e1 "text"
AGENT_BROWSER_HOME=$AB_HOME ./bin/agent-browser --cdp 9222 press Enter
# Capture result
sleep 2
AGENT_BROWSER_HOME=$AB_HOME ./bin/agent-browser --cdp 9222 screenshot /tmp/result.png