360 Secure SkillHub
360 安全技能中心

Browser Auto Plus

提供浏览器自动化命令集,覆盖导航、页面交互、元素发现、截图验证与 CSS/XPath 数据提取,并说明 Chrome、Firefox、Edge 切换、指数退避重试、CAPTCHA 检测与代理设置。依赖 Playwright 安装浏览器,通过宿主提供的 browser 命令序列执行。

534422530
534422530
热度 16.02
最近更新 2026-06-05 12:23:47
分类:自动化依赖:联网浏览搜索 / 代码执行应用场景:自动化脚本 / 工作流 / 数据处理

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add browser-auto-plus
Metadata
name
browser-auto-plus
description
Enhanced browser automation with error recovery, retry logic, multi-browser support, screenshot verification, and integration with web scraping. Supports Chrome, Firefox, Edge with automatic failover.
metadata
{"author":"opencode","version":2,"tags":"browser, automation, web-scraping, error-recovery","compatibility":"opencode","license":"MIT"}

Browser Auto Plus

Enhanced browser automation with error recovery, retry logic, multi-browser support, and screenshot verification.

Features

  • Multi-Browser Support: Chrome, Firefox, Edge with automatic failover
  • Error Recovery: Automatic retry with exponential backoff
  • Screenshot Verification: Visual confirmation after each action
  • Web Scraping Integration: Extract data with CSS/XPath selectors
  • CAPTCHA Handling: Detection and manual/automatic solving
  • Proxy Support: Route through proxies for anonymity

Setup

# Check available browsers
npx playwright install

# Or install specific browser
npx playwright install chromium
npx playwright install firefox
npx playwright install webkit

Commands

# Navigate
browser navigate <url>

# Interact
browser act "<action>"

# Extract data
browser extract "<instruction>" ['{}']

# Discover elements
browser observe "<query>"

# Take screenshot
browser screenshot

# Close browser
browser close

Error Recovery

Retry Logic

// Automatic retry with exponential backoff
const retry = async (fn, maxRetries = 3) => {
  for (let i = 0; i < maxRetries; i++) {
    try {
      return await fn();
    } catch (error) {
      if (i === maxRetries - 1) throw error;
      await new Promise(r => setTimeout(r, Math.pow(2, i) * 1000));
    }
  }
};

Common Errors and Solutions

Error Solution
Element not found Use browser observe to discover elements
Timeout Increase timeout or use retry logic
CAPTCHA detected Switch to manual solving or proxy
Navigation failed Check URL, network, try different browser
Screenshot failed Verify browser is running

Multi-Browser Support

Browser Selection

# Use specific browser
BROWSER=firefox browser navigate <url>

# Use headless mode
HEADLESS=true browser navigate <url>

# Use proxy
PROXY=http://proxy:port browser navigate <url>

Browser Comparison

Feature Chrome Firefox Edge
Speed Fast Medium Fast
Memory High Medium Medium
Stealth Medium High Medium
Extensions Yes Yes Yes
Best for General Privacy Windows

Screenshot Verification

# Take screenshot after action
browser act "click Sign In"
browser screenshot

# Take screenshot with custom name
browser screenshot --name "after-login"

# Take full page screenshot
browser screenshot --full-page

Web Scraping Integration

Extract with Selectors

# Extract using CSS selector
browser extract "document.querySelectorAll('.product-title')"

# Extract using XPath
browser extract "document.evaluate('//div[@class=\"price\"]', document, null, XPathResult.ANY_TYPE, null)"

# Extract with data transformation
browser extract "
  Array.from(document.querySelectorAll('.item')).map(item => ({
    title: item.querySelector('.title').textContent,
    price: item.querySelector('.price').textContent,
    link: item.querySelector('a').href
  }))
"

Anti-Detection

# Randomize user agent
browser act "set user agent to random"

# Add random delays
browser act "wait 1-3 seconds"

# Randomize viewport
browser act "set viewport to random size"

CAPTCHA Handling

Detection

# Check for CAPTCHA
browser observe "CAPTCHA, reCAPTCHA, hCaptcha, Cloudflare"

# If found, take screenshot for manual solving
browser screenshot --name "captcha"

Solutions

  1. Manual Solving: Take screenshot, solve manually, continue
  2. Proxy Rotation: Switch IP to avoid CAPTCHA
  3. Browser Fingerprint: Use stealth plugins
  4. Rate Limiting: Add delays between requests

Best Practices

  1. Always navigate first before interacting
  2. View screenshots after each command to verify
  3. Be specific in action descriptions
  4. Close browser when done
  5. Use retry logic for flaky operations
  6. Log errors for debugging
  7. Respect robots.txt and rate limits
  8. Use headless mode for automation
  9. Handle errors gracefully with fallbacks
  10. Verify results with screenshots/extraction

Troubleshooting

  • Browser not found: Install with npx playwright install
  • Element not found: Use browser observe to discover elements
  • Timeout: Increase timeout or check network
  • CAPTCHA: Switch browser, use proxy, or solve manually
  • Memory leak: Close browser periodically
  • Detection: Use stealth mode, random delays, proxy

Anti-Detection Techniques

  1. Random Delays: 1-5 second delays between actions
  2. User Agent Rotation: Randomize browser fingerprint
  3. Viewport Randomization: Vary window size
  4. Cookie Management: Handle cookies properly
  5. Proxy Rotation: Change IP periodically
  6. Human-like Behavior: Random mouse movements, scrolling

Integration with Web Scraping

# Full scraping workflow
browser navigate "https://example.com/products"
browser observe ".product-list"
browser extract "
  Array.from(document.querySelectorAll('.product')).map(p => ({
    name: p.querySelector('.name').textContent,
    price: p.querySelector('.price').textContent,
    rating: p.querySelector('.rating').textContent
  }))
"
browser screenshot --name "products"
browser close