chrome-cdp by hanyu0001/chrome-cdp-skill
npx skills add https://github.com/hanyu0001/chrome-cdp-skill --skill chrome-cdp轻量级 Chrome DevTools Protocol 命令行工具。通过 WebSocket 直接连接 —— 无需 Puppeteer,支持 100+ 个标签页,即时连接。
chrome://inspect/#remote-debugging 并切换开关DevToolsActivePort 文件位于非标准位置,请将 CDP_PORT_FILE 环境变量设置为其完整路径所有命令都使用 scripts/cdp.mjs。<target> 是来自 list 命令输出的一个唯一的 targetId 前缀;请复制 list 输出中显示的完整前缀(例如 6BE827FA)。CLI 会拒绝不明确的前缀。
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
scripts/cdp.mjs list
scripts/cdp.mjs shot <target> [file] # 默认:在运行时目录下生成 screenshot-<target>.png
仅捕获当前视口。如果需要获取首屏以下的内容,请先用 eval 命令滚动页面。输出包含页面的 DPR 和坐标转换提示(见下文坐标部分)。
scripts/cdp.mjs snap <target>
scripts/cdp.mjs eval <target> <expr>
注意: 当 DOM 可能在多次
eval调用之间发生变化时(例如点击“忽略”后,卡片索引会移动),应避免使用基于索引的选择器(如querySelectorAll(...)[i])。请在一次eval中收集所有数据,或使用稳定的选择器。
scripts/cdp.mjs html <target> [selector] # 获取整个页面或指定元素的 HTML
scripts/cdp.mjs nav <target> <url> # 导航到指定 URL 并等待加载完成
scripts/cdp.mjs net <target> # 获取资源计时条目
scripts/cdp.mjs click <target> <selector> # 通过 CSS 选择器点击元素
scripts/cdp.mjs clickxy <target> <x> <y> # 在 CSS 像素坐标处点击
scripts/cdp.mjs type <target> <text> # 在当前焦点处插入文本;与 eval 不同,此命令在跨域 iframe 中有效
scripts/cdp.mjs loadall <target> <selector> [ms] # 点击“加载更多”直到消失(默认点击间隔 1500 毫秒)
scripts/cdp.mjs evalraw <target> <method> [json] # 原始 CDP 命令透传
scripts/cdp.mjs open [url] # 打开新标签页(每次都会触发“允许调试”提示)
scripts/cdp.mjs stop [target] # 停止守护进程
shot 命令以原生分辨率保存图像:图像像素 = CSS 像素 × DPR。CDP 输入事件(如 clickxy 等)使用 CSS 像素。
CSS px = 截图图像 px / DPR
shot 命令会打印当前页面的 DPR。典型的 Retina 屏幕(DPR=2):将截图坐标除以 2。
snap --compact 而非 html。type(而非 eval)—— 先用 click/clickxy 聚焦,然后 type。每周安装量
166
代码仓库
GitHub 星标数
4
首次出现
9 天前
安全审计
安装于
mcpjam166
github-copilot166
kilo166
gemini-cli166
junie166
windsurf166
Lightweight Chrome DevTools Protocol CLI. Connects directly via WebSocket — no Puppeteer, works with 100+ tabs, instant connection.
chrome://inspect/#remote-debugging and toggle the switchDevToolsActivePort is in a non-standard location, set CDP_PORT_FILE to its full pathAll commands use scripts/cdp.mjs. The <target> is a unique targetId prefix from list; copy the full prefix shown in the list output (for example 6BE827FA). The CLI rejects ambiguous prefixes.
scripts/cdp.mjs list
scripts/cdp.mjs shot <target> [file] # default: screenshot-<target>.png in runtime dir
Captures the viewport only. Scroll first with eval if you need content below the fold. Output includes the page's DPR and coordinate conversion hint (see Coordinates below).
scripts/cdp.mjs snap <target>
scripts/cdp.mjs eval <target> <expr>
Watch out: avoid index-based selection (
querySelectorAll(...)[i]) across multipleevalcalls when the DOM can change between them (e.g. after clicking Ignore, card indices shift). Collect all data in oneevalor use stable selectors.
scripts/cdp.mjs html <target> [selector] # full page or element HTML
scripts/cdp.mjs nav <target> <url> # navigate and wait for load
scripts/cdp.mjs net <target> # resource timing entries
scripts/cdp.mjs click <target> <selector> # click element by CSS selector
scripts/cdp.mjs clickxy <target> <x> <y> # click at CSS pixel coords
scripts/cdp.mjs type <target> <text> # Input.insertText at current focus; works in cross-origin iframes unlike eval
scripts/cdp.mjs loadall <target> <selector> [ms] # click "load more" until gone (default 1500ms between clicks)
scripts/cdp.mjs evalraw <target> <method> [json] # raw CDP command passthrough
scripts/cdp.mjs open [url] # open new tab (each triggers Allow prompt)
scripts/cdp.mjs stop [target] # stop daemon(s)
shot saves an image at native resolution: image pixels = CSS pixels × DPR. CDP Input events (clickxy etc.) take CSS pixels.
CSS px = screenshot image px / DPR
shot prints the DPR for the current page. Typical Retina (DPR=2): divide screenshot coords by 2.
snap --compact over html for page structure.type (not eval) to enter text in cross-origin iframes — click/clickxy to focus first, then type.Weekly Installs
166
Repository
GitHub Stars
4
First Seen
9 days ago
Security Audits
Gen Agent Trust HubWarnSocketPassSnykWarn
Installed on
mcpjam166
github-copilot166
kilo166
gemini-cli166
junie166
windsurf166
Skills CLI 使用指南:AI Agent 技能包管理器安装与管理教程
33,600 周安装
Magento 2 Hyvä CMS 组件创建器 - 快速构建自定义CMS组件
163 周安装
项目文档协调器 - 自动化文档生成与上下文管理工具
163 周安装
GPUI 布局与样式:Rust 类型安全的 CSS 样式库,Flexbox 布局与链式 API
163 周安装
Telegram自动化指南:通过Rube MCP与Composio实现消息发送、聊天管理
163 周安装
AI内容生成工具:一键生成图像、图表、文档、提案和PDF,提升内容创作效率
164 周安装
iOS无障碍功能开发指南:VoiceOver、动态字体、WCAG合规性检查与App Store审核
164 周安装