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 從公開儲存庫中收錄這些內容。

檢舉或申請下架