Token导航 LogoToken导航TokenDH.com
研究检索操作浏览器clawhub未标认证来源可访问clear审计提醒

chrome-cdp-controller铬色 CDP 控制器

Agent Skill

chrome-cdp-controller 用于处理浏览器自动化、网页检查和页面信息提取,适合在 OpenClaw 中需要让 Agent 打开页面、读取网页或验证前端流程时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

3,927

周安装

162

GitHub Stars

公开资料未说明

下载量

1,283
OpenClaw

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

MIT-0

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:chrome-cdp-controller(铬色 CDP 控制器)
来源仓库:https://github.com/hanxiaolin/chrome-cdp-controller
安装命令:
openclaw skills install chrome-cdp-controller
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 OpenClaw 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

ClawHubOpenClaw
openclaw skills install chrome-cdp-controller

简介

该技能用于通过 Puppeteer 和 Chrome DevTools 协议控制本地 Chrome 浏览器。

  • 适用于自动执行页面导航、单击操作或表单填写等浏览器任务。
  • 支持 DOM 快照、网络请求监控与脚本执行等功能。
  • 安装前需确认权限范围、维护状态,以及是否涉及联网或文件读写操作。
  • 建议核对原始 README 以了解启动配置与远程调试端口设置。

SKILL.md

name
chrome-cdp-controller
description
Control local Chrome browser via Chrome DevTools Protocol (CDP) using Puppeteer. Use when you need to automate browser tasks like navigating pages, clicking elements, filling forms, taking screenshots, executing JavaScript, or intercepting network responses. Works with Chrome instances that already have CDP enabled. Common use cases include web scraping (e.g., "Search iPhone on Taobao and get prices"), automated testing, interacting with web apps (e.g., "Ask ChatGPT a question"), or monitoring network traffic.

Chrome CDP Controller (Puppeteer)

Control and automate a Chrome browser that's already running with CDP enabled, using Puppeteer.

Key Features

  • Non-intrusive: Connects to your existing Chrome, opens a new tab, operates, then closes only that tab
  • Your browser stays open: Never closes your existing tabs or browser
  • Clean automation: Each task runs in its own tab, which is automatically closed when done

1. Chrome with CDP Enabled

Chrome must be running with remote debugging enabled. If not already started:

# macOS
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222 &

# Windows
"C:\Program Files\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222

# Linux
google-chrome --remote-debugging-port=9222 &

2. Get WebSocket URL

Visit http://localhost:9222/json/version to get the webSocketDebuggerUrl, for example:

ws://127.0.0.1:9222/devtools/browser/FFA7276F8E8E51645BD2AC9BE6B79607

Or use this one-liner:

curl -s http://localhost:9222/json/version | grep -o '"webSocketDebuggerUrl":"[^"]*"' | cut -d'"' -f4

3. Install Dependencies

cd chrome-cdp-controller
npm install

This installs puppeteer-core which is lightweight (doesn't download Chromium).

Usage

Command-Based Execution

Create a JSON file with commands:

commands.json:

[
  {"type": "navigate", "url": "https://www.baidu.com"},
  {"type": "wait", "seconds": 2},
  {"type": "screenshot", "path": "/tmp/screenshot.png"},
  {"type": "evaluate", "script": "document.title"}
]

Execute:

node scripts/cdp_controller.js --ws "ws://127.0.0.1:9222/devtools/browser/..." --commands commands.json

Node.js API

const { CDPController } = require('./scripts/cdp_controller.js');

(async () => {
  const controller = new CDPController('ws://127.0.0.1:9222/devtools/browser/...');
  await controller.connect();
  
  // Navigate
  await controller.navigate('https://www.taobao.com');
  
  // Fill form
  await controller.fill('#q', 'iPhone');
  await controller.press('Enter');
  await controller.wait(3);
  
  // Extract data
  const result = await controller.evaluate(`
    Array.from(document.querySelectorAll('.item'))
      .slice(0, 10)
      .map(item => ({
        title: item.querySelector('.title')?.textContent.trim(),
        price: item.querySelector('.price')?.textContent.trim()
      }))
  `);
  console.log(result.result);
  
  // Intercept network
  await controller.startIntercept('*api*');
  // ... perform actions ...
  const responses = controller.getInterceptedResponses();
  
  await controller.close();
})();

Available Commands

Navigation

  • navigate - Go to URL

- url: Target URL - waitUntil: "load", "domcontentloaded", or "networkidle2" (default)

Interaction

  • click - Click an element

- selector: CSS selector - timeout: Timeout in milliseconds (default: 5000)

  • fill - Fill a form field (selects all, then types)

- selector: CSS selector - text: Text to fill - timeout: Timeout in milliseconds (default: 5000)

  • type - Type text character by character

- selector: CSS selector - text: Text to type - delay: Delay between characters in ms (default: 50) - timeout: Timeout in milliseconds (default: 5000)

  • press - Press a key

- key: Key name (Enter, Tab, Escape, etc.)

Data Extraction

  • get_text - Get text content of a single element

- selector: CSS selector

  • get_all_text - Get text content of all matching elements

- selector: CSS selector

  • evaluate - Execute JavaScript and return result

- script: JavaScript code

Network Interception

  • start_intercept - Start intercepting network responses

- url_pattern: URL pattern to match (substring match, e.g., "api")

  • get_intercepted - Get all intercepted responses
  • clear_intercepted - Clear intercepted responses list

Utilities

  • screenshot - Take a screenshot

- path: Output file path - fullPage: Capture full page (default: false)

  • wait_for_selector - Wait for element to appear

- selector: CSS selector - timeout: Timeout in milliseconds (default: 5000)

  • wait - Sleep for a duration

- seconds: Number of seconds to wait

Common Workflows

Example 1: Search Taobao for iPhone Prices

taobao-search.json:

[
  {"type": "navigate", "url": "https://www.taobao.com"},
  {"type": "wait", "seconds": 2},
  {"type": "fill", "selector": "#q", "text": "iPhone"},
  {"type": "press", "key": "Enter"},
  {"type": "wait", "seconds": 5},
  {"type": "evaluate", "script": "Array.from(document.querySelectorAll('.item, [class*=\"Item\"]')).slice(0, 10).map(item => ({ title: item.querySelector('.title, [class*=\"title\"]')?.textContent.trim().substring(0, 80), price: item.querySelector('.price, [class*=\"price\"]')?.textContent.trim() }))"}
]

Run:

WS_URL=$(curl -s http://localhost:9222/json/version | grep -o '"webSocketDebuggerUrl":"[^"]*"' | cut -d'"' -f4)
node scripts/cdp_controller.js --ws "$WS_URL" --commands taobao-search.json

Note: Selectors may vary. Use browser DevTools (F12) to inspect elements.

Example 2: Ask ChatGPT a Question

chatgpt-ask.json:

[
  {"type": "navigate", "url": "https://chat.openai.com"},
  {"type": "wait_for_selector", "selector": "textarea", "timeout": 10000},
  {"type": "type", "selector": "textarea", "text": "What is artificial intelligence?"},
  {"type": "press", "key": "Enter"},
  {"type": "wait", "seconds": 10},
  {"type": "get_text", "selector": "[data-message-author-role='assistant']:last-of-type"}
]

Example 3: Intercept API Responses

intercept-api.json:

[
  {"type": "start_intercept", "url_pattern": "graphql"},
  {"type": "navigate", "url": "https://example.com"},
  {"type": "wait", "seconds": 3},
  {"type": "get_intercepted"}
]

For more examples, see references/examples.md.

Workflow

When automating browser tasks:

  1. Get WebSocket URL:

- If you already have it (e.g., ws://127.0.0.1:9222/devtools/browser/...), use it directly - Otherwise, fetch from http://localhost:9222/json/version

  1. Determine selectors:

- For known sites (Taobao, ChatGPT, etc.), check references/examples.md - For unknown sites, navigate first and use evaluate with document.querySelector to test selectors - Use browser DevTools (F12) to inspect elements

  1. Build command sequence:

- Start with navigate - Add wait or wait_for_selector between steps - Use fill for form inputs, click for buttons - Use evaluate for complex data extraction - Add start_intercept before navigation if monitoring network traffic

  1. Execute:

- Save commands to JSON file - Run: node scripts/cdp_controller.js --ws "<websocket-url>" --commands <file> - Parse JSON output

  1. Handle failures:

- If selectors fail, inspect with DevTools - If timing issues occur, increase wait times or use wait_for_selector - If connection fails, verify Chrome is running with CDP enabled

Tips

  • Wait times: Use wait_for_selector instead of fixed wait when possible
  • Selectors: Prefer ID (#id) > class (.class) > attribute ([attr='value'])
  • Network interception: Start intercepting BEFORE navigating
  • JavaScript: Use evaluate for complex data extraction
  • Screenshots: Useful for debugging

Troubleshooting

Connection Failed

  • Ensure Chrome is running with --remote-debugging-port=9222
  • Verify WebSocket URL is correct
  • Check Chrome version compatibility with puppeteer-core

Element Not Found

  • Verify selector with DevTools (F12)
  • Add wait_for_selector before interaction
  • Check if element is in an iframe

Module Not Found

cd chrome-cdp-controller
npm install

适合场景

01

OpenClaw 用户查找和安装 Skill 时

02

用户想查找某类 Agent Skill 时

03

需要根据任务场景推荐可安装能力包时

04

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

OpenClaw

76.9%
按下载量换算987

安全审计

VirusTotal

可疑

ClawScan

通过

Static analysis

可疑

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills