跳到主内容
智客 ZICQ

技能库 智客分类:Agent 工作流 chrome-automation

Chrome Automation

使用代理浏览器CLI自动实现Chrome浏览器任务. 导航页面,填表,点击按钮,取取截图,取取取数据,并重放Chrome DevTools Recorder导出.

3730 安装量

官方网址:skills.sh

技能介绍

先看中文介绍;官方 description 原文单独保留,不改写 SKILL.md。

做什么

使用代理浏览器CLI自动实现Chrome浏览器任务. 导航页面,填表,点击按钮,取取截图,取取取数据,并重放Chrome DevTools Recorder导出.

何时用

官方 description 未单独写出 Use when。按规范,代理会在用户任务与这段 description 的关键词匹配时激活本技能。

代理如何加载

按 Agent Skills 渐进披露:启动时只加载 name 与 description(约 100 token);任务匹配后才读入整份 SKILL.md 正文;scripts/、references/、assets/ 仅在需要时再读。 本文件正文结构:Skill: Chrome Automation (agent-browser)、Core Principle: Reuse the User's Existing Chrome、Always Start by Listing Tabs、Why This Matters、Connection、Chrome 144+ WebSocket-Only Fallback。 其中含规范建议的小节:分步指令。

文件分析

文件分析:除 SKILL.md 外,正文引用了 references/agent-browser-setup.md、references/x.md、references/reddit.md、references/linkedin.md、references/devto.md、references/hackernews.md,属于带资源的技能包,这些文件按需再读。

官方 description(原文)

Automate Chrome browser tasks using agent-browser CLI. Navigate pages, fill forms, click buttons, take screenshots, extract data, and replay Chrome DevTools Recorder exports.

Skill: Chrome Automation (agent-browser)Core Principle: Reuse the User's Existing ChromeAlways Start by Listing TabsWhy This MattersConnectionChrome 144+ WebSocket-Only FallbackCommon Workflows1. Navigate and InteractList tabs to find existing pagesSwitch to an existing tab (if found)Or open a new pageTake a snapshot to see interactive elements

来源分类:skills.sh agent-skill

SKILL.md 与 Agent 调用

官方规范 ↗
name
chrome-automation
description
Automate Chrome browser tasks using agent-browser CLI. Navigate pages, fill forms, click buttons, take screenshots, extract data, and replay Chrome DevTools Recorder exports.
  1. 发现技能客户端向 Agent 提供名称与描述目录。
  2. 匹配与调用用户指定或任务匹配后,载入 SKILL.md 指令。
  3. 按需加载按步骤读取参考文档、使用脚本与素材。
指令中引用的文件 · 6
  • references/agent-browser-setup.md
  • references/x.md
  • references/reddit.md
  • references/linkedin.md
  • references/devto.md
  • references/hackernews.md

以下路径提取自原文;文件是否齐全请以来源仓库中的完整目录为准。

具体调用语法与可用工具以目标 Agent 客户端为准。 查看调用机制说明 ↗

安装这个技能

Skills CLI ↗

先选择目标 Agent 和安装范围,保留技能包的附属文件,安装后检查客户端能否发现该技能。

该技能引用了附属文件,请从来源获取完整目录;仅复制 SKILL.md 可能缺少依赖。

交给 Agent 安装

复制安装指令给支持 Agent Skills 的代理,确认其中的目标目录与客户端匹配。

把 Agent Skill「chrome-automation」安装到我的项目:SKILL.md 原文与官方 description 见 https://zicq.com/zh/skills/skl-cd5557dc5e27d2e3-Chrome-%E8%87%AA%E5%8A%A8%E5%8C%96.html
请存为 .cursor/skills/chrome-automation/SKILL.md 或 .claude/skills/chrome-automation/SKILL.md,frontmatter 的 name 与 description 保持原样,不要改写。
该技能还带 scripts/、references/、assets/ 等文件,请从 https://github.com/zc277584121/marketing-skills 取完整目录,不要只建一个 SKILL.md。

GitHub 完整包 ↗

终端安装 · Skills CLI

需要 Node.js 与 npx。先查看仓库技能列表,确认实际名称。

npx skills add 'https://github.com/zc277584121/marketing-skills' --list

npx skills add 'https://github.com/zc277584121/marketing-skills' --skill 'chrome-automation'

CLI 会交互选择目标 Agent,默认安装到项目;用户级安装使用 -g。先通过查看命令核对仓库内容,再用 npx skills list 检查已安装技能。

阅读排版
--- name: chrome-automation description: Automate Chrome browser tasks using agent-browser CLI. Navigate pages, fill forms, click buttons, take screenshots, extract data, and replay Chrome DevTools Recorder exports. --- # Skill: Chrome Automation (agent-browser) Automate browser tasks in the user's real Chrome session via the [agent-browser](https://github.com/vercel-labs/agent-browser) CLI. > **Prerequisite**: agent-browser must be installed and Chrome must have remote debugging enabled. See `references/agent-browser-setup.md` if unsure. --- ## Core Principle: Reuse the User's Existing Chrome This skill operates on a **single Chrome process** — the user's real browser. There is no session management, no separate profiles, no launching a fresh Playwright browser. ### Always Start by Listing Tabs Before opening any new page, **always list existing tabs first**: ```bash agent-browser --auto-connect tab list ``` This returns all open tabs with their index numbers, titles, and URLs. Check if the page you need is already open: - **If the target page is already open** → switch to that tab directly instead of opening a new one. The user likely has it open because they are already logged in and the page is in the right state. ```bash agent-browser --auto-connect tab ``` - **If the target page is NOT open** → open it in the current tab or a new tab. ```bash agent-browser --auto-connect open ``` ### Why This Matters - The user's Chrome has their cookies, login sessions, and browser state - Opening a new page when one is already available wastes time and may lose login state - Many marketing platforms (social media dashboards, ad managers, CMS tools) require login — reusing an existing logged-in tab avoids re-authentication --- ## Connection Always use `--auto-connect` to connect to the user's running Chrome instance: ```bash agent-browser --auto-connect ``` This auto-discovers Chrome with remote debugging enabled. If connection fails, guide the user through enabling remote debugging (see `references/agent-browser-setup.md`). ### Chrome 144+ WebSocket-Only Fallback Chrome 144+ can expose remote debugging from `chrome://inspect/#remote-debugging` as a WebSocket-only endpoint. In that state the page shows `Server running at: 127.0.0.1:9222`, but the traditional discovery URLs return 404: ```bash curl http://127.0.0.1:9222/json/version curl http://127.0.0.1:9222/json/list ``` Older `agent-browser` versions such as `0.27.x` may fail with `No running Chrome instance found` even though Chrome is ready. First try the latest CLI without changing the global install: ```bash npx -y agent-browser@latest connect "ws://127.0.0.1:9222/devtools/browser" npx -y agent-browser@latest tab list ``` If this works, use `npx -y agent-browser@latest ` for the rest of the browser task. If it fails with an engine warning or install error, upgrade Node to 24+ or install the latest `agent-browser` globally. --- ## Common Workflows ### 1. Navigate and Interact ```bash # List tabs to find existing pages agent-browser --auto-connect tab list # Switch to an existing tab (if found) agent-browser --auto-connect tab # Or open a new page agent-browser --auto-connect open https://example.com agent-browser --auto-connect wait --load networkidle # Take a snapshot to see interactive elements agent-browser --auto-connect snapshot -i # Click, fill, etc. agent-browser --auto-connect click @e3 agent-browser --auto-connect fill @e5 "some text" ``` ### 2. Extract Data from a Page ```bash # Get all text content agent-browser --auto-connect get text body # Take a screenshot for visual inspection agent-browser --auto-connect screenshot # Execute JavaScript for structured data agent-browser --auto-connect eval "JSON.stringify(document.querySelectorAll('table tr').length)" ``` ### 3. Replay a Chrome DevTools Recording The user may provide a recording exported from Chrome DevTools Recorder (JSON, Puppeteer JS, or @puppeteer/replay JS format). See [Replaying Recordings](#replaying-recordings) below. ## Step-by-Step Interaction Guide ### Taking Snapshots Use `snapshot -i` to see all interactive elements with refs (`@e1`, `@e2`, ...): ```bash agent-browser --auto-connect snapshot -i ``` The output lists each interactive element with its role, text, and ref. Use these refs for subsequent actions. ### Step Type Mapping | Action | Command | |--------|---------| | Navigate | `agent-browser --auto-connect open ` (optionally `wait --load networkidle`, but some sites like Reddit never reach networkidle — skip if `open` already shows the page title) | | Click | `snapshot -i` → find ref → `click @eN` | | Fill standard input | `click @eN` → `fill @eN "text"` | | Fill rich text editor | `click @eN` → `keyboard inserttext "text"` | | Press key | `press ` (Enter, Tab, Escape, etc.) | | Scroll | `scroll down ` or `scroll up ` | | Wait for element | `wait @eN` or `wait ""` | | Screenshot | `screenshot` or `screenshot --annotate` | | Get page text | `get text body` | | Get current URL | `get url` | | Run JavaScript | `eval ` | ### How to Distinguish Input Types - **Standard input/textarea** → use `fill` - **Contenteditable div / rich text editor** (LinkedIn message box, Gmail compose, Slack, CMS editors) → click/focus first, then use `keyboard inserttext` ### Ref Lifecycle Refs (`@e1`, `@e2`, ...) are **invalidated when the page changes**. Always re-snapshot after: - Clicking links or buttons that trigger navigation - Submitting forms - Triggering dynamic content loads (AJAX, SPA navigation) ### Verification After each significant action, verify the result: ```bash agent-browser --auto-connect snapshot -i # check interactive state agent-browser --auto-connect screenshot # visual verification ``` --- ## Replaying Recordings ### Accepted Formats 1. **JSON** (recommended) — structured, can be read progressively: ```bash # Count steps jq '.steps | length' recording.json # Read first 5 steps jq '.steps[0:5]' recording.json ``` 2. **@puppeteer/replay JS** (`import { createRunner }`) 3. **Puppeteer JS** (`require('puppeteer')`, `page.goto`, `Locator.race`) ### How to Replay 1. **Parse the recording** — understand the full intent before acting. Summarize what the recording does. 2. **List tabs first** — check if the target page is already open. 3. **Navigate** — execute `navigate` steps, reusing existing tabs when possible. 4. **For each interaction step**: - Take a snapshot (`snapshot -i`) to see current interactive elements - Match the recording's `aria/...` selectors against the snapshot - Fall back to `text/...`, then CSS class hints, then screenshot - **Do not rely on ember IDs, numeric IDs, or exact XPaths** — these change every page load 5. **Verify after each step** — snapshot or screenshot to confirm --- ## Iframe-Heavy Sites `snapshot -i` operates on the main frame only and **cannot penetrate iframes**. Sites like LinkedIn, Gmail, and embedded editors render content inside iframes. ### Detecting Iframe Issues - `snapshot -i` returns unexpectedly short or empty results - Recording references elements not appearing in snapshot output - `get text body` content doesn't match what a screenshot shows ### Workarounds 1. **Use `eval` to access iframe content**: ```bash agent-browser --auto-connect eval --stdin <<'EVALEOF' const frame = document.querySelector('iframe[data-testid="interop-iframe"]'); const doc = frame.contentDocument; const btn = doc.querySelector('button[aria-label="Send"]'); btn.click(); EVALEOF ``` Note: Only works for same-origin iframes. 2. **Use `keyboard` for blind input**: If the iframe element has focus, `keyboard inserttext "..."` sends text regardless of frame boundaries. 3. **Use `get text body`** to read full page content including iframes. 4. **Use `screenshot`** for visual verification when snapshot is unreliable. ### When to Ask the User If workarounds fail after 2 attempts on the same step, pause and explain: - The page uses iframes that cannot be accessed via snapshot - Which element you need and what you expected - Ask the user to perform that step manually, then continue --- ## Handling Unexpected Situations ### Handle Automatically (do not stop): - Popups or banners → dismiss them (`find text "Dismiss" click` or `find text "Close" click`) - Cookie consent dialogs → accept or dismiss - Tooltip overlays → close them first - Element not in snapshot → try `find text "..." click`, or scroll to reveal with `scroll down 300` ### Pause and Ask the User: - Login / authentication is required - A CAPTCHA appears - Page structure is completely different from expected - A destructive action is about to happen (deleting data, sending real content) — confirm first - Stuck for more than 2 attempts on the same step - All iframe workarounds have failed When pausing, explain clearly: what step you are on, what you expected, and what you see. --- ## Key Commands Reference | Command | Description | |---------|-------------| | `tab list` | List all open tabs with index, title, and URL | | `tab ` | Switch to an existing tab by index | | `tab new` | Open a new empty tab | | `tab close` | Close the current tab | | `open ` | Navigate to URL | | `snapshot -i` | List interactive elements with refs | | `click @eN` | Click element by ref | | `fill @eN "text"` | Clear and fill standard input/textarea | | `type @eN "text"` | Type without clearing | | `keyboard inserttext "text"` | Insert text (best for contenteditable) | | `press ` | Press keyboard key | | `scroll down/up ` | Scroll page in pixels | | `wait @eN` | Wait for element to appear | | `wait --load networkidle` | Wait for network to settle | | `wait ` | Wait for a duration | | `screenshot [path]` | Take screenshot | | `screenshot --annotate` | Screenshot with numbered labels | | `eval ` | Execute JavaScript in page | | `get text body` | Get all text content | | `get url` | Get current URL | | `set viewport ` | Set viewport size | | `find text "..." click` | Semantic find and click | | `close` | Close browser session | --- ## Known Limitations 1. **Iframe blindness**: `snapshot -i` cannot see inside iframes. See [Iframe-Heavy Sites](#iframe-heavy-sites). 2. **`find text` strict mode**: Fails when multiple elements match. Use `snapshot -i` to locate the specific ref instead. 3. **`fill` vs contenteditable**: `fill` only works on `` and ``. For rich text editors, use `keyboard inserttext`. 4. **`eval` is main-frame only**: To interact with iframe content, traverse via `document.querySelector('iframe').contentDocument...` --- ## Multi-Platform Operations When the user requests an action across **multiple platforms** (e.g., "publish this article to Dev.to, LinkedIn, and X"), do NOT attempt all platforms in a single conversation. Instead, launch **sequential subagents/workers**, one per platform. Selecting this skill is explicit permission to use subagents/workers for this multi-platform workflow. ### Why Subagents Each platform operation consumes ~25-40K tokens (reference file + snapshots + interactions). Running 3-5 platforms in one context risks hitting the context limit and degrading late-platform accuracy. Each subagent/worker gets its own fresh context window. ### How to Execute 1. **Prepare the content** — confirm the post text, title, tags, and any platform-specific adaptations with the user. 2. **For each platform**, launch a subagent/worker with a prompt that includes: - The full content to publish - Instructions to read the relevant reference file (e.g., `Read /path/to/skills/chrome-automation/references/x.md`) - Instructions to read the agent-browser skill file for command reference - The specific task (post, comment, reply, etc.) - Any platform-specific instructions (e.g., "use these hashtags on LinkedIn") 3. **Run subagents/workers sequentially** (one at a time), because they all share the same Chrome browser via `--auto-connect`. Parallel subagents/workers would cause tab conflicts. 4. **After each subagent/worker completes**, report the result to the user before launching the next one. ### Prompt Template for Subagents ``` You are automating a browser task on [PLATFORM]. First, read these files for context: - /absolute/path/to/skills/chrome-automation/references/[platform].md - The installed agent-browser skill file, if available (agent-browser command reference) Then connect to the user's Chrome browser using `agent-browser --auto-connect` and perform the following task: [TASK DESCRIPTION] Content to publish: [CONTENT] Important: - Always list tabs first (`tab list`) and reuse existing logged-in tabs - Re-snapshot after every navigation or action - Confirm with the user before submitting/publishing (destructive action) - If login is required or a CAPTCHA appears, stop and explain ``` ### When NOT to Use Subagents - **Single platform** — just do it directly in the current conversation. - **Read-only tasks** (browsing, searching, extracting data) — context usage is lighter; a single conversation can handle 2-3 platforms. --- ## Platform References When automating tasks on specific platforms, consult the relevant reference document for page structure details, common operations, and known quirks: | Platform | Reference | Key Notes | |----------|-----------|-----------| | Reddit | [`references/reddit.md`](./references/reddit.md) | Custom `faceplate-*` components; `networkidle` never reached; unlabeled comment textbox; `find text` fails due to duplicate elements | | X (Twitter) | [`references/x.md`](./references/x.md) | `open` often times out (use `tab list` to reuse existing tabs); click **timestamp** for post detail (not username); DraftJS contenteditable input (`data-testid="tweetTextarea_0"`); avoid `networkidle` | | LinkedIn | [`references/linkedin.md`](./references/linkedin.md) | Ember.js SPA; Enter submits comments (use Shift+Enter for newlines); comment box and compose box share the same label; avoid `networkidle`; messaging overlay may block content | | Dev.to | [`references/devto.md`](./references/devto.md) | Fast server-rendered HTML (Forem/Rails); standard `<textarea>` for comments/posts (Markdown); 5 reaction types; Algolia-powered search; `networkidle` works normally | | Hacker News | [`references/hackernews.md`](./references/hackernews.md) | Minimal plain HTML; all form fields are unlabeled; `link "reply"` navigates to separate page; `networkidle` works instantly; rate limiting on posts/comments | --- > For installation and Chrome setup instructions, see [`references/agent-browser-setup.md`](./references/agent-browser-setup.md).

相关技能

Agent 工作流

Skill Creator

创造有效技能指南。 当用户想创造出新的技能(或更新现有的技能),以专业知识,工作流程,或工具集成来扩展克洛德的能力时,应该使用这种技能.

Agent 工作流

Clawdhub

使用ClawdHub CLI搜索,安装,更新并发布从taladhub.com的代理技能. 需要获取苍蝇上的新技能时使用,将安装的技能同步到最新版本或特定版本,或者发布 npm-instainddhub CLI 的新/更新的技能文件夹.

Agent 工作流

Agent Team Orchestration

管弦乐团多代理团队,任务设定周期,交接协议,审查工作流程. 使用时间: (1)建立2+特派员队伍,具有不同专业,(2)确定任务路线和生命周期(收录框_ spec_建设_审查_完成),(3)在特派员之间制定交接协议,(4)建立审查和质量关口,(5)管理特派员之间的交流和文物共享.

Agent 工作流

Superpowers

Spec-first,TDD,子代理驱动的软件开发工作流程. 当:(1)构建任何新功能或应用——触发脑暴_计划_子代理执行回路,(2)调试出一个bug或测试失败——触发系统性的根起过程,(3)用户说"让我们构建","帮助我计划","我想添加X",或"这个被打破",(4)完成一个功…