跳到正文
cccskills
免费在 GitHub 公开

browser-edge-cases

Troubleshoot browser automation when clicks, typing, scrolling, or page snapshots fail on complex websites. Inspect page structure and errors, apply waits or alternative interaction methods, and verify the fix on both problematic and simple pages.

中文简介正在准备中。当前显示英语简介。

原文查看原文说明

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.

查看安装方法

适用场景

  • Fix scrolling that misses a feed’s scrollable container
  • Investigate clicks and text entry that have no effect
  • Handle stalled or outdated page snapshots
  • Inspect elements inside Shadow DOM components

包含的文件(12)

  • SKILL.md6.9 KB
  • registry.md10.4 KB
  • scripts/test_02_twitter_scroll.py3.5 KB
  • scripts/test_03_modal_scroll.py3.0 KB
  • scripts/test_04_element_covered.py4.0 KB
  • scripts/test_06_shadow_dom.py5.0 KB
  • scripts/test_07_contenteditable.py6.4 KB
  • scripts/test_08_autocomplete.py9.1 KB
  • scripts/test_10_huge_dom.py5.4 KB
  • scripts/test_13_spa_navigation.py6.5 KB
  • scripts/test_15_screenshot.py8.6 KB
  • scripts/test_case.py11.8 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

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 move
  • browser_interact(action="left_click") succeeds but no action triggered
  • browser_interact(action="type") text disappears or doesn't work
  • browser_snapshot hangs or returns stale content
  • browser_navigate loads 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

SymptomLikely CauseCheck
Scroll doesn't moveNested scroll containerLook for overflow: scroll divs
Click no effectElement coveredCheck getBoundingClientRect vs viewport
Type clearsAutocomplete/ReactCheck for event listeners on input; try a type action with no selector
Snapshot hangsHuge DOMCheck node count in snapshot
Snapshot staleSPA hydrationWait 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 web apps

Detection: If CDP click doesn't trigger handler but manual click works.

Fix: Use JavaScript click as primary:

element.click();

P4: Huge DOM / Accessibility Tree

Sites: LinkedIn, Facebook, Twitter (feeds with 1000s of nodes)

Detection:

document.querySelectorAll('*').length > 5000

Fix:

  1. Add timeout to snapshot operation
  2. Truncate tree at 2000 nodes
  3. Fall back to DOM-based snapshot if accessibility tree too large

P5: SPA Hydration Delay

Sites: React, Vue, Angular SPAs after navigation

Detection:

// Check if React app has hydrated
document.querySelector('[data-reactroot]') ||
document.querySelector('[data-reactid]')

Fix: Wait for specific selector after navigation:

await browser_navigate(tab_id, url, wait_until="load")
await browser_interact(action="wait", tab_id=tab_id, wait_for_selector='[data-testid="content"]', timeout_ms=5000)

P6: Shadow DOM

Sites: Components using Shadow DOM, Lit elements

Detection:

document.querySelectorAll('*').some(el => el.shadowRoot)

Fix: Pierce shadow root:

function queryShadow(selector) {
    const parts = selector.split('>>>');
    let node = document;
    for (const part of parts) {
        if (node.shadowRoot) {
            node = node.shadowRoot.querySelector(part.trim());
        } else {
            node = node.querySelector(part.trim());
        }
    }
    return node;
}

Quick Reference

IssuePrimary FixFallback
Scroll not workingFind scrollable containerMouse wheel at container center
Click no effectJavaScript click()CDP mouse events
Type clearsuse_insert_text=False (per-keystroke)Use a type action (Input.insertText)
Snapshot hangsAdd timeout_sDOM snapshot fallback
Stale contentWait for selectorIncrease wait_until timeout
Shadow DOMPierce selectorJavaScript traversal

References

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Automate an existing Chrome session through hive-browser commands. Covers page inspection, screenshot-based clicks, text entry, and result checks, including controls hidden inside nested web components and recovery steps for connection timeouts.

中文简介正在准备中。当前显示英语简介。

  • Fill in web forms through Chrome
  • Click visible controls missing from page snapshots
  • Check that a rich-text editor accepted input
aden-hive/hive1.1万2026年10月19日 更新

Create charts for numeric data and diagrams for processes or relationships. Explains how to choose ECharts or Mermaid, apply clear formatting, and use chart_render to display the result in chat and save a downloadable PNG.

中文简介正在准备中。当前显示英语简介。

  • Comparing revenue across regions or products
  • Showing trends across multiple metrics
  • Turning workflows or system relationships into diagrams
aden-hive/hive1.1万2026年10月19日 更新

Track shared work across AI agents using a SQLite database. The skill claims tasks, records progress and evidence for each step, skips completed work, and checks required procedures before marking a task complete.

中文简介正在准备中。当前显示英语简介。

  • Assigning work from a shared queue to multiple agents
  • Resuming tasks while skipping completed steps
  • Checking required procedures before task completion
aden-hive/hive1.1万2026年10月19日 更新

Preserve essential information during long agent tasks by extracting URLs, IDs, relevant fields, and conclusions into working notes. It also specifies where to record task handoff details before older tool results leave the agent’s context.

中文简介正在准备中。当前显示英语简介。

  • Keep source URLs and key excerpts during research
  • Preserve API fields and IDs needed later
  • Record analysis conclusions before context pruning
aden-hive/hive1.1万2026年10月19日 更新

Handle failed tool calls with a clear recovery process. The skill distinguishes temporary problems from input or setup issues, chooses whether to retry or change approach, and records failures so unsuccessful tasks are not silently lost.

中文简介正在准备中。当前显示英语简介。

  • Deciding whether to retry a failed tool call
  • Correcting inputs after setup or validation errors
  • Switching approaches after repeated tool failures
aden-hive/hive1.1万2026年10月19日 更新

Create logos, illustrations, product images, and other visuals from text, or edit and combine reference images. The skill guides generation through Hive, waiting for results, and delivering saved images, with costs charged to Hive credits.

中文简介正在准备中。当前显示英语简介。

  • Create a logo or illustration from a written brief
  • Change the background of a product photo
  • Place an existing logo on a mockup
aden-hive/hive1.1万2026年10月19日 更新

查看 aden-hive 的全部技能

报告此技能的问题