← 返回
未分类 中文

Patchright Stealth Browsing

Perform stealth browser automation to bypass bot detection (Cloudflare, Akamai, Datadome) using Patchright.
使用 Patchright 进行隐蔽浏览器自动化,绕过 Bot 检测(Cloudflare、Akamai、Datadome)。
cyber-bye cyber-bye 来源
未分类 clawhub v2.1.1 2 版本 100000 Key: 无需
★ 0
Stars
📥 118
下载
💾 2
安装
2
版本
#latest

概述

Patchright Stealth Browsing Skill

> [!IMPORTANT]

> Hard Dependency Warning:

> This skill is strictly dependent on the patchright-mcp server. It will not work unless the patchright-mcp server is correctly installed, configured, and running in the OpenClaw environment.

>

> Repository Access:

> The patchright-mcp server repository is private. Accessing, cloning, and managing the server requires proper authentication credentials and repository privileges.

This skill enables the OpenClaw agent to automate browser interactions stealthily on websites protected by active anti-bot systems (e.g., Cloudflare, Akamai, Datadome). It runs over the patchright-mcp server, which uses a patched Chromium browser.

The browser capabilities are consolidated into four core tools:

  1. patchright_navigation: Manages page lifecycle, navigation, HTML content retrieval, and screenshot captures.
  2. patchright_interaction: Executes clicks, text typing, option selections, scrolling, global keys, and elements synchronization.
  3. patchright_session: Handles reading, writing, and clearing context cookies, as well as named profiles.
  4. patchright_execution: Evaluates page scripts and extracts structured interactive element snapshots.

Guidelines for the Agent

  1. Sequential Lifecycle Management:
    • Begin by navigating directly using patchright_navigation with action navigate and the target url.
    • Always finish execution by calling patchright_navigation with action close to safely release the browser process and memory.
  1. Stealth Interaction Flow:
    • To interact with a page, first get the structure using patchright_execution with action snapshot. This extracts all visible interactive elements (buttons, links, inputs) along with their CSS selectors.
    • Use the retrieved selectors to trigger clicks, hovers, or inputs via patchright_interaction.
  1. Performance Optimization (Bulk Fill):
    • When filling forms with multiple inputs, do not call fill repeatedly. Instead, use patchright_interaction with action bulk_fill and pass the list of fields in the items array. This reduces roundtrips and handles fallback evaluations automatically.
  1. Synchronizations and Waits:
    • If pages load elements dynamically, synchronize using patchright_interaction with action wait_for targeting the element's selector and expected state (visible, hidden, attached, or detached).
  1. Visual Validation:
    • Capture screenshots using patchright_navigation with action screenshot after major actions (like form submissions or clicks) to verify the visual state of the page.
  1. Authentication & Session Reuse:
    • Use patchright_session with action get_cookies to save authentication state, and set_cookies to restore sessions without needing to re-login.
  1. Multi-Page & Tab Targeting:
    • Multiple tabs can be targeted using the optional pageIndex parameter (zero-based index) available in navigation, interaction, and execution tools.
    • List active tabs with patchright_navigation (action list_pages) and select the target tab using pageIndex instead of performing profile switches.
  1. Video Recording & Verification:
    • To record interaction videos, set the recordVideo: true flag in the open or navigate actions.
    • Videos are saved as WebM files in ~/videos.
    • Use patchright_navigation with action close_page to finalize the video for a specific tab, or call list_videos to retrieve the paths of recorded files.
  1. Dynamic Proxy Configuration & Rotation:
    • Pass proxy parameters (proxyServer, proxyBypass, proxyUsername, proxyPassword) inside the open, navigate, or create_profile actions to route traffic.
    • To rotate proxies dynamically, pass the new proxyServer parameter in subsequent calls; the server will automatically recreate the context with the new proxy.
    • Omit proxy parameters to continue using the active proxy of the context.
    • To explicitly clear/remove the proxy and restore system/direct routing, call the open action without proxy parameters.
  1. Custom Client Configurations:
    • You can dynamically override browser launch settings by passing parameters such as headless, userAgent, viewport (e.g. { "width": 800, "height": 600 }), and deviceScaleFactor to the open or navigate actions inside patchright_navigation.
    • Use these overrides to simulate different device types (mobile/desktop viewports) or rotate user agents to prevent fingerprint-based blockings.

Edge Cases and Failure Handling

  1. Element Selector Timeouts:
    • If an interaction (e.g., click, fill) fails due to a timeout, verify if the element is loaded by calling patchright_interaction with action wait_for and state visible.
    • If an element is hidden or obstructed by a modal, use patchright_execution with action evaluate to trigger a native JS click: document.querySelector('selector').click().
  1. Isolated Context Variable Sharing:
    • Remember that evaluate scripts execute in an isolated context (utility world) for anti-bot stealth.
    • If you need to verify or set properties on the page's main execution context, store them as custom DOM attributes (e.g., element.setAttribute('data-state', 'value')) rather than attaching them directly to window.propertyName.
  1. Anti-bot Block Pages / CAPTCHAs:
    • If you encounter a CAPTCHA or blocker page, do not repeat failing navigation commands.
    • Run patchright_navigation with action screenshot to verify if a challenge is present.
    • If a challenge page appears, instruct the user or wait for manual solver actions, rather than retrying automated scripts recursively.
  1. CDP Connection Disconnects:
    • If the remote CDP port 9222 falls back to a subprocess launch, verify if the process crashed by retrying open. The server automatically spins up a local fallback browser if the remote socket is unresponsive.

版本历史

共 2 个版本

  • v2.1.1 当前
    2026-06-09 18:57
  • v2.0.0
    2026-06-07 13:26 安全 安全

安全检测

腾讯云安全 (Keen)

队列中

腾讯云安全 (Sanbu)

队列中

🔗 相关推荐

Self Improvement Cyber Bye

cyber-bye
即时捕获错误、幻觉、逻辑缺陷及用户更正;每日 IST 23:00 自检并尝试自动修复,失败则升级至人工处理。
★ 2 📥 488

Workflow Guardian

cyber-bye
为任意任务类型定义、执行并跟踪结构化工作流。管理应做/不应做规则、执行顺序、硬性关卡、软性建议、检查点等。
★ 2 📥 420

Identity Manager

cyber-bye
为对话中提到的每个人、组织或群体创建、更新并维护结构化身份条目,支持人类和AI实体子类型。
★ 2 📥 448