← 返回
未分类 中文

Browser Fu

Fixes browser automation failures. Snapshot-first workflow + API discovery behind any website UI. Use when: 'browser not working', 'can't click', 'flaky UI',...
修复浏览器自动化问题。快照优先工作流 + 网站 UI 背后的 API 发现。使用场景:浏览器不工作、无法点击、UI 不稳定等。
whooshinglander whooshinglander 来源
未分类 clawhub v1.0.2 1 版本 99814.5 Key: 无需
★ 1
Stars
📥 518
下载
💾 2
安装
1
版本
#latest

概述

Browser Fu 🥊

Stop fighting the DOM. Read it first, find the API behind it, skip the UI entirely when possible.

The Rule

Never blind-click. Always snapshot first.

1. browser snapshot  →  read the page, get element refs
2. browser act       →  use refs from snapshot (e.g. ref="e12")
3. browser snapshot  →  verify what changed

If the snapshot doesn't show what you need, the element isn't in the DOM. Don't guess. Don't retry the same approach.

Decision Tree

On any browser task, follow this order:

  1. Can I skip the browser entirely? Check if a CLI tool, API, or web_fetch handles it. If yes, don't open the browser.
  2. Can I find the underlying API? See references/api-discovery.md. Most SPAs make fetch/XHR calls you can replicate directly. This is 10x faster and more reliable than UI automation.
  3. Can I do it with snapshot + act? Snapshot, find the ref, act on it. One action per snapshot cycle.
  4. Does the page need time to load? Use loadState: "networkidle" or a brief wait before snapshotting. SPAs often render asynchronously.
  5. Still not working? The site likely has anti-bot protection. Report it, don't retry blindly.

Common Failures and Fixes

SymptomWrong approachRight approach
---------
"Element not found"Click by text/selector guessSnapshot first, use exact ref
"DOM not exposed"Give upSnapshot with refs="aria", or check network tab for API
Blank/empty pageRetry same URLloadState: "networkidle", then snapshot. If still blank, JS-heavy SPA, try web_fetch or find API
Clicking does nothingClick again harderSnapshot after click to check state. Maybe it DID work but page re-rendered
Login wallTry to automate loginUse profile="user" for existing session cookies
Infinite scrollScroll and prayFind the pagination API endpoint instead

API Discovery (the power move)

Most modern websites are SPAs with REST/GraphQL APIs behind the UI. See references/api-discovery.md for the full procedure:

  1. Open the page in browser
  2. Check network requests (console tool or snapshot the page and look for fetch patterns)
  3. Find the data endpoint
  4. Call it directly with web_fetch or exec curl

This turns a 2-hour flaky scrape into a 2-minute clean data pull.

Snapshot Best Practices

  • Use refs="aria" for stable cross-call references
  • Keep the same targetId across snapshot/act pairs (don't switch tabs accidentally)
  • For complex pages, use depth to limit how deep the DOM tree goes
  • compact: true reduces token usage on large pages
  • For token-heavy pages where snapshots are too large, pair with predicate-snapshot for ML-ranked element pruning (~95% fewer tokens)

When to NOT Use Browser

  • Reading public web pages → web_fetch (faster, no browser overhead)
  • Search queries → web_search (Brave API)
  • Known APIs (GitHub, Stripe, etc.) → use their CLI/API directly
  • Pages that return empty via web_fetch → then use browser

Safeguards

  • Never store or output passwords, session tokens, or cookies found in browser state
  • Never automate purchases, payments, or irreversible actions without explicit user approval
  • If a site blocks automation, respect it. Don't circumvent CAPTCHAs or bot detection

版本历史

共 1 个版本

  • v1.0.2 当前
    2026-03-30 20:01 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

dev-programming

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 677 📥 327,400
dev-programming

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 72 📥 181,859
dev-programming

Mcporter

steipete
使用 mcporter CLI 直接列出、配置、认证及调用 MCP 服务器/工具(支持 HTTP 或 stdio),涵盖临时服务器、配置编辑及 CLI/类型生成功能。
★ 195 📥 67,658