browser-edge-cases
它能做什么
这个技能为 AI 提供一套逐步方法,用于找出浏览器任务在复杂网站上失败的原因。适合构建或运行自动化浏览器任务的人。
适用场景
- ✓当网站上的滚动或点击看似执行了,但什么也没发生的时候。
- ✓当输入的文字消失,或页面一直显示旧内容的时候。
- ✓当浏览器步骤在脚本繁重的网站上加载了错误页面的时候。
技能链接
https://github.com/aden-hive/hive/blob/main/.claude/skills/browser-edge-cases/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我的浏览器机器人在 LinkedIn 上点击按钮后没有任何反应。我想找出原因并修复。”
每周 5 个新技能,1 分钟读完。
工作原理
AI 会先在一个简单网站上测试浏览器,然后在困难的网站上检查控制台和页面结构。它会比较两者的结果以找出原因,并调整步骤。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Browser Tool Edge Cases
Standard Operating Procedure for debugging and fixing browser automation failures on complex websites.
When to Use This Skill
browser_interact(action="scroll")succeeds but page doesn't movebrowser_interact(action="left_click")succeeds but no action triggeredbrowser_interact(action="type")text disappears or doesn't workbrowser_snapshothangs or returns stale contentbrowser_navigateloads wrong content
SOP: Debugging Browser Tool Failures
Phase 1: Reproduce & Isolate
1. Create minimal test case demonstrating failure
2. Test against simple site (example.com) to verify tool works
3. Test against problematic site to confirm issue
Quick isolation test:
# Test 1: Does the tool work at all?
await browser_navigate(tab_id, "https://example.com")
result = await browser_interact(action="scroll", tab_id=tab_id, scroll_direction="down", scroll_amount=100)
# Should work on simple sites
# Test 2: Does it fail on the problematic site?
await browser_navigate(tab_id, "https://linkedin.com/feed")
result = await browser_interact(action="scroll", tab_id=tab_id, scroll_direction="down", scroll_amount=100)
# If this fails but example.com works → site-specific edge case
Phase 2: Analyze Root Cause
Step 2a: Check console for errors
console = await browser_console(tab_id)
# Look for: CSP violations, React errors, JavaScript exceptions
Step 2b: Inspect DOM structure
html = await browser_html(tab_id)
snapshot = await browser_snapshot(tab_id)
# Look for:
# - Nested scrollable divs (overflow: scroll/auto)
# - Shadow DOM roots
# - iframes
# - Custom widgets
Step 2c: Identify the pattern
| Symptom | Likely Cause | Check |
|---|---|---|
| Scroll doesn't move | Nested scroll container | Look for overflow: scroll divs |
| Click no effect | Element covered | Check getBoundingClientRect vs viewport |
| Type clears | Autocomplete/React | Check for event listeners on input; try a type action with no selector |
| Snapshot hangs | Huge DOM | Check node count in snapshot |
| Snapshot stale | SPA hydration | Wait after navigation |
Phase 3: Implement Multi-Layer Fix
Pattern: Always have fallbacks
async def robust_operation(tab_id):
# Method 1: Primary approach
try:
result = await primary_method(tab_id)
if verify_success(result):
return result
except Exception:
pass
# Method 2: CDP fallback
try:
result = await cdp_fallback(tab_id)
if verify_success(result):
return result
except Exception:
pass
# Method 3: JavaScript fallback
return await javascript_fallback(tab_id)
Pattern: Always add timeouts
# Bad - can hang forever
result = await browser_snapshot(tab_id)
# Good - fails fast with useful error
try:
result = await browser_snapshot(tab_id, timeout_s=10.0)
except asyncio.TimeoutError:
# Handle timeout gracefully
result = await fallback_snapshot(tab_id)
Phase 4: Verify Fix
1. Run against problematic site → should work
2. Run against simple site → should still work (regression check)
3. Document in registry.md
Pattern Library
P1: Nested Scrollable Containers
Sites: LinkedIn, Twitter/X, any SPA with scrollable feeds
Detection:
// Find largest scrollable container
const candidates = [];
document.querySelectorAll('*').forEach(el => {
const style = getComputedStyle(el);
if (style.overflow.includes('scroll') || style.overflow.includes('auto')) {
const rect = el.getBoundingClientRect();
if (rect.width > 100 && rect.height > 100) {
candidates.push({el, area: rect.width * rect.height});
}
}
});
candidates.sort((a, b) => b.area - a.area);
return candidates[0]?.el;
Fix: Dispatch scroll events at container's center, not viewport center.
P2: Element Covered by Overlay
Sites: Modals, tooltips, SPAs with loading overlays
Detection:
const rect = element.getBoundingClientRect();
const centerX = rect.left + rect.width / 2;
const centerY = rect.top + rect.height / 2;
const topElement = document.elementFromPoint(centerX, centerY);
return topElement === element || element.contains(topElement);
Fix: Wait for overlay to disappear, or use JavaScript click.
P3: React Synthetic Events
Sites: React SPAs, modern
常见问题
它适用于任何网站吗?
它是为 LinkedIn、X 以及带有隐藏页面部分的单页应用等复杂网站编写的。
AI 从哪里开始?
它会先用最小测试重现失败,然后再修改任何内容。
它使用哪些浏览器工具?
它使用导航、快照、交互和控制台检查等浏览器工具。
详情
作者的原始描述
SOP for debugging browser automation failures on complex websites. Use when browser tools fail on specific sites like LinkedIn, Twitter/X, SPAs, or sites with Shadow DOM.
repo: aden-hive/hive
热度
- GitHub 星标
- 11k
- 排名
- #11797
- 许可证
- Apache-2.0
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
hive.browser-automation
11k教你的智能体使用 hive-browser 工具控制你自己的 Chrome 浏览器,通过截图和点击完成操作。
hive.colony-progress-tracker
11k帮你的智能体认领任务,并把它的步骤和检查记录在共享数据库中,让工作在进行中就被跟踪。
hive.context-preservation
11k帮你的智能体在较早的细节从记忆中被移除之前,把长篇工具结果中的关键事实保存到笔记里。
hive.error-recovery
11k帮你的智能体按清晰的方案处理失败的工具步骤:重试一次、修正输入、跳过该项,或上报处理。