← Back to Skills Marketplace
mayf3

Brave Browser Agent

by mayf3 · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
40
Downloads
0
Stars
1
Active Installs
1
Versions
Install in OpenClaw
/install brave-browser-agent
Description
Control Brave Browser via CDP for web browsing, content extraction, screenshots, and JavaScript execution. Use when needing browser automation, web scraping,...
README (SKILL.md)

Brave Browser Agent

Attach to the user's daily Brave Browser via CDP on port 9222. The browser has all login sessions and bookmarks. Agents only attach — never start, restart, or kill the browser.

Critical Rules

⚠️ 绝对禁止启动/重启/关闭浏览器! 浏览器由用户手动管理,agent 只 attach。 ⚠️ 绝对不要使用 --restart 参数! 除非用户明确要求。

Multiple agents share the same browser instance (port 9222), which has all user login states.

  • Port: 9222 — Brave's remote debugging port (non-configurable)
  • Do NOT start/restart/kill browser — Browser is manually managed by user, agents only attach
  • Do NOT use openclaw browser start — Will crash Gateway
  • Do NOT use openclaw gateway restart — Will crash Gateway
  • Do NOT use --restart parameter — Strictly prohibited unless explicitly requested
  • Read-first preference — Use eval to extract content, avoid modifying page state
  • If 9222 doesn't respond, tell user: "Brave Browser 未启动远程调试,请手动开启" — do NOT auto-start

Quick Start

Diagnostic Health Check (Recommended)

# Full check: CDP connection, tabs, script syntax, SKILL.md health
python3 {{SKILL_DIR}}/scripts/check_cdp.py

# Quick check (connection only)
python3 {{SKILL_DIR}}/scripts/check_cdp.py --quick

# JSON output for debugging
python3 {{SKILL_DIR}}/scripts/check_cdp.py --json

Check Browser Status (Legacy)

python3 {{SKILL_DIR}}/scripts/check_brave.py

List Tabs

python3 {{SKILL_DIR}}/scripts/cdp_exec.py list

Open a Page

python3 {{SKILL_DIR}}/scripts/cdp_exec.py open "https://example.com"

Execute JavaScript

python3 {{SKILL_DIR}}/scripts/cdp_exec.py eval \x3Ctab_id> "document.title"

Take Screenshot

python3 {{SKILL_DIR}}/scripts/cdp_exec.py screenshot \x3Ctab_id> output.png

Smart Interaction (Anti-Detection)

For anti-bot sites (Xiaohongshu, etc.), use CDP native mouse events instead of JS .click():

# Click element — real mouse events, isTrusted=true
python3 {{SKILL_DIR}}/scripts/cdp_exec.py interact \x3Ctab_id> --selector "button.submit"

# Type text into focused element
python3 {{SKILL_DIR}}/scripts/cdp_exec.py type \x3Ctab_id> "search query" --human

# Press a key
python3 {{SKILL_DIR}}/scripts/cdp_exec.py key \x3Ctab_id> Enter

Framework-Aware Click (React/Vue/Angular SPAs)

For SPA sites where standard CDP clicks fail (React/Vue/Angular), use multi-strategy auto-fallback:

# Multi-strategy click (auto: CDP native → React Fiber → Vue emit → dispatchEvent → Enter)
python3 {{SKILL_DIR}}/scripts/cdp_exec.py click-smart \x3Ctab_id> --selector "button.submit"

# Or find by text content
python3 {{SKILL_DIR}}/scripts/cdp_exec.py click-smart \x3Ctab_id> --text "发布"

# Detect which JS framework the page uses
python3 {{SKILL_DIR}}/scripts/cdp_exec.py detect-framework \x3Ctab_id>

# Deep-analyze a button (debugging)
python3 {{SKILL_DIR}}/scripts/cdp_exec.py analyze-button \x3Ctab_id> --selector "button.submit"

What click-smart Does (Strategy Order)

  1. Editor sync — Auto-syncs rich text editors before clicking (CKEditor 4/5, Lexical, ProseMirror, Quill, 语雀, iframe editors). Critical for Vue/React editors where content is not synced to framework state
  2. Hit-test check — ScrollIntoView + elementFromPoint (ensures element is visible and uncovered)
  3. CDP native click — Input.dispatchMouseEvent with complete event sequence
  4. React Fiber invocation — Calls React's onClick handler via __reactProps$. Fallback: React 18 root container event delegation for ByteUI/headless UI
  5. Vue emit invocation — Enhanced Vue 2/3 detection: component tree traversal, $emit, $listeners, setupState handlers, vnode event walk
  6. dispatchEvent — Creates a native MouseEvent(isTrusted=true) and dispatches it
  7. Enter key — Focus + Enter key + form submit (for form buttons)

Publish Validation (auto): After all strategies, detects success via toast messages, URL changes, modal state, and button state. Reports errors if found.

Returns JSON showing which strategy succeeded and debugging info.

New Standalone Commands

# Validate if publish was successful (after clicking)
python3 {{SKILL_DIR}}/scripts/framework_click.py publish-validate \x3Ctab_id>

# Sync editor data without clicking
python3 {{SKILL_DIR}}/scripts/framework_click.py editor-sync \x3Ctab_id>

Platform-Specific Notes

Platform Framework Known Issue Solution
掘金 Vue 2 发布弹出层按钮 CDP 点击无效 click-smart auto-syncs editor → tries Vue enhanced click
CSDN Vue 3 + CKEditor iframe 字数统计更新但按钮无反应 editor-sync fires CKEditor change:data + iframe input event
头条号 React ByteUI onClick 调用成功但无变化 click-smart tries React 18 root delegation + deep fiber traversal
阿里云开发者 语雀编辑器 非 contenteditable,注入困难 editor-sync triggers lake-editor input events
百家号 Lexical contenteditable 注入 editor-sync calls lexical update + dispatchCommand

Framework Detection Commands

# Quick framework detection
python3 {{SKILL_DIR}}/scripts/cdp_exec.py detect-framework \x3Ctab_id>

# Deep button analysis (for debugging)
python3 {{SKILL_DIR}}/scripts/cdp_exec.py analyze-button \x3Ctab_id> --selector "button.submit"
python3 {{SKILL_DIR}}/scripts/cdp_exec.py analyze-button \x3Ctab_id> --selector "button.submit" --index 0

Click Strategy Quick Reference

Task Command Why
Simple click (known site) interact Lightweight, uses CDP native events
Click on React/Vue SPA click-smart Auto-tries 6 strategies + diagnostics
Click keeps failing detect-framework + analyze-button Debug overlay/modals/disabled state
Form button that won't click click-smart Auto-tries Enter key + form submit

Wait for Page State

# Wait for page load
python3 {{SKILL_DIR}}/scripts/cdp_exec.py wait \x3Ctab_id> --page-load --timeout 10

# Wait for element to appear
python3 {{SKILL_DIR}}/scripts/cdp_exec.py wait \x3Ctab_id> --selector ".result" --timeout 10

# Wait for network idle
python3 {{SKILL_DIR}}/scripts/cdp_exec.py wait \x3Ctab_id> --network-idle --timeout 15

Page State Analysis

# List interactive elements (useful for exploring unknown pages)
python3 {{SKILL_DIR}}/scripts/cdp_exec.py elements \x3Ctab_id>

# Check page load status
python3 {{SKILL_DIR}}/scripts/cdp_exec.py page-status \x3Ctab_id>

# Detect pagination buttons
python3 {{SKILL_DIR}}/scripts/cdp_exec.py pagination \x3Ctab_id>

# Count elements matching selector
python3 {{SKILL_DIR}}/scripts/cdp_exec.py count \x3Ctab_id> --selector ".item"

# Smooth scroll (triggers lazy loading)
python3 {{SKILL_DIR}}/scripts/cdp_exec.py scroll \x3Ctab_id> --direction down --steps 3

# Highlight element for screenshot debugging
python3 {{SKILL_DIR}}/scripts/cdp_exec.py highlight \x3Ctab_id> --selector "#target"

When to Use What

Task Command Why
Read content eval No interaction needed
Simple click eval "el.click()" Trusted sites
Anti-detection click interact isTrusted=true
Fill form (anti-bot) type --human Char-by-char
Fill form (fast) type Bulk insert
Wait for content wait Dynamic pages
Infinite scroll scroll Lazy loading
Explore page elements Unknown structure

Command Reference

All commands go through cdp_exec.py:

Command Description
list List open tabs
status Check browser status
open \x3Curl> Open URL in new tab
close \x3Ctab_id> Close tab
eval \x3Ctab_id> \x3Cjs> Execute JavaScript
screenshot \x3Ctab_id> [file] Take screenshot
interact \x3Ctab_id> CDP native mouse click
type \x3Ctab_id> \x3Ctext> Type text
key \x3Ctab_id> \x3Ckey> Press keyboard key
wait \x3Ctab_id> Wait for page state
scroll \x3Ctab_id> Smooth scroll
elements \x3Ctab_id> List interactive elements
page-status \x3Ctab_id> Page load status
pagination \x3Ctab_id> Detect pagination buttons
count \x3Ctab_id> Count elements by selector
locate \x3Ctab_id> Get element coordinates
highlight \x3Ctab_id> Highlight element outline
snapshot \x3Ctab_id> Lightweight DOM snapshot
click-smart \x3Ctab_id> Multi-strategy click (React/Vue auto-fallback)
detect-framework \x3Ctab_id> Detect JS framework on page
analyze-button \x3Ctab_id> Deep-analyze a button element

Common Patterns

For detailed usage patterns and workflows, see references/PATTERNS.md.

For site-specific anti-detection strategies (Xiaohongshu, SPA pages, etc.), see references/site-patterns.md.

For React/Vue/Angular framework-aware clicking and platform-specific strategies (头条号, 掘金, CSDN, etc.), see references/framework-publish.md.

Troubleshooting

Problem Fix
CDP HTTP error Check Brave is running with curl -s http://localhost:9222/json/version. If not, ask user to restart Brave with --remote-debugging-port=9222
Tab not found Run cdp_exec.py list to get current tab IDs
JS Error Check if page loaded; add --await-promise for async ops
websockets not installed pip3 install websockets
Brave won't respond Ask user to restart Brave. DO NOT kill the process yourself.
Click not working Use interact instead of eval ".click()" for anti-bot sites
Element not found Use elements to check page structure; wait before interacting
Usage Guidance
Install only if you are comfortable giving the agent control of a logged-in Brave profile. Prefer a separate Brave profile or test browser with no personal sessions, avoid using the cookie/storage examples unless explicitly needed, review every click-smart or publish-related command before use, and do not run it on accounts or pages where unintended posting, form submission, or data capture would be harmful.
Capability Assessment
Purpose & Capability
The stated browser automation purpose matches CDP tab control, extraction, screenshots, JavaScript execution, typing, and clicking, but the artifacts also include anti-detection guidance, cookie/localStorage/sessionStorage extraction examples, framework-internal handler invocation, editor syncing, and publish-validation flows that raise the impact beyond ordinary browsing.
Instruction Scope
The skill says to prefer read-first behavior, but its documented commands and helper scripts support state-changing clicks, typing, form submission, tab closing, and publish-oriented workflows without a clear confirmation gate for irreversible actions.
Install Mechanism
The package does not declare external dependency installation, startup hooks, or browser lifecycle management; scripts are local Python helpers and the documentation repeatedly tells agents not to start, restart, or kill Brave.
Credentials
The skill intentionally attaches to the user's daily Brave browser on port 9222, which the documentation says contains active login sessions and bookmarks; arbitrary JavaScript and screenshots against that profile can expose or alter sensitive authenticated content.
Persistence & Privilege
No background persistence, privilege escalation, or remote exfiltration code was found, but screenshots are written to disk and the tool can open/close tabs and perform authenticated browser actions through the live profile.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install brave-browser-agent
  3. After installation, invoke the skill by name or use /brave-browser-agent
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
Brave Browser Agent 1.0.0 — Initial Release - Attach to user-controlled Brave Browser (port 9222) for automation; does not manage browser lifecycle. - Supports content extraction, robust clicking (multi-framework), script execution, tab listing, and screenshots. - Adds anti-detection strategies: CDP-native user events, multi-strategy SPA click handling (React/Vue/Angular). - Includes health check/diagnostic scripts and advanced commands for editor sync, page analysis, and element interaction. - Comprehensive documentation with strict rules forbidding browser start/restart. - Provides CLI quick-starts, troubleshooting, and framework-aware automation guidance.
Metadata
Slug brave-browser-agent
Version 1.0.0
License MIT-0
All-time Installs 1
Active Installs 1
Total Versions 1
Frequently Asked Questions

What is Brave Browser Agent?

Control Brave Browser via CDP for web browsing, content extraction, screenshots, and JavaScript execution. Use when needing browser automation, web scraping,... It is an AI Agent Skill for Claude Code / OpenClaw, with 40 downloads so far.

How do I install Brave Browser Agent?

Run "/install brave-browser-agent" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Brave Browser Agent free?

Yes, Brave Browser Agent is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Brave Browser Agent support?

Brave Browser Agent is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Brave Browser Agent?

It is built and maintained by mayf3 (@mayf3); the current version is v1.0.0.

💬 Comments