Playwriter

作者 brianlovin1a9819ebf3fe无许可证376 个星标收录于 2026年10月8日更新于 2026年10月8日仓库6个月前更新

Control the user's currently open Chrome tab through the Playwriter CLI (no new browser launch). Use when you need to inspect live UI state, run scripted browser actions, capture console output, or reproduce frontend issues directly in the user's tab.

AI 生成的概览

通过 Playwriter CLI 操作用户当前打开的 Chrome 标签页,检查界面状态并执行浏览器操作。

功能
该技能指导代理使用 Playwriter CLI 连接到用户当前活动的 Chrome 标签页,而不是启动新的浏览器。内容包括创建会话、确认所连接的标签页、通过无障碍快照收集页面结构,以及执行点击、输入、悬停、fetch 和 evaluate 等针对性操作。它还会收集控制台输出和结构化页面状态,并汇总带有确切 ID、时间戳和观察到的状态变化的发现。
适用场景
当你需要在用户自己的标签页中检查实时界面状态、运行脚本化浏览器操作、捕获控制台输出,或直接在该标签页中复现前端问题时使用。它适合对已打开的页面进行调试和检查,而不是启动全新的浏览器会话。
运行要求
需要在目标标签页上启用 Playwriter 浏览器扩展,并在本地或通过 npx 提供 Playwriter CLI。通过 npx 获取 CLI 需要网络访问。该技能不附带脚本,仅为说明文档。

Playwriter

Use this skill to drive the user's active Chrome tab via Playwriter.

Full documentation is available here: https://playwriter.dev/

Quick Start

  1. Ensure the Playwriter extension is enabled (green) on the target tab.
  2. Ensure CLI is available:
bash
playwriter --version || npx -y playwriter --version
  1. Create/attach a session:
bash
playwriter session new
  1. Run commands against that session:
bash
playwriter -s 1 -e "console.log(await page.url())"

Core Workflow

  1. Confirm connection and correct tab:
bash
playwriter -s <session> -e "console.log(await page.url()); console.log(await page.title());"
  1. Collect page structure when needed:
bash
playwriter -s <session> -e "console.log(await accessibilitySnapshot({ page }))"
  1. Execute targeted actions (click/type/hover/fetch/evaluate).
  2. Pull logs and structured state via page.evaluate.
  3. Summarize findings with exact IDs, timestamps, and observed state transitions.

Useful Commands

Get list rows/options from current app UI:

bash
playwriter -s <session> -e "const rows = await page.getByRole('option').all(); console.log(rows.length);"

Read popup/hover content:

bash
playwriter -s <session> -e "const row = page.getByRole('option').nth(0); await row.hover(); await page.waitForTimeout(700); console.log(await page.locator('[data-side]').first().innerText());"

Run arbitrary in-page debug code:

bash
playwriter -s <session> -e "const out = await page.evaluate(() => ({ href: location.href })); console.log(out);"

Troubleshooting

  • If the session attaches to the wrong tab, click the extension icon on the intended tab and re-run playwriter session new.
  • If playwriter command is missing, use npx -y playwriter ... or install globally.
  • If execution errors suggest stale connection, create a fresh session.

Guardrails

  • Prefer read-only inspection unless the task requires mutation.
  • Announce destructive UI actions before running them.
  • When capturing logs, redact sensitive tokens/user data in summaries.

来源与署名

来源:brianlovin/agent-config位于skills/playwriter提交1a9819e

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架