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

run-playwrightRUN Playwright 搜索

Agent Skill

用于辅助测试设计、自动化测试、用例整理和回归验证。它适合让 Agent 编写单元测试、端到端测试、测试计划或根据失败日志定位问题。使用时需要确认项目测试框架、运行命令和夹具数据,避免为了通过测试而改坏真实逻辑;涉及浏览器或外部服务时,应区分本地模拟、测试环境和生产环境。

总安装

447

周安装

19

GitHub Stars

5

下载量

157
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

请帮我安装这个 Agent Skill:run-playwright(RUN Playwright 搜索)
来源仓库:https://github.com/yigitkonur/skills-by-yigitkonur
仓库路径:skills/run-playwright
安装命令:
npx skills add https://github.com/yigitkonur/skills-by-yigitkonur --skill run-playwright
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/yigitkonur/skills-by-yigitkonur --skill run-playwright

简介

用于辅助测试设计、自动化测试、用例整理和回归验证。

  • 适合让 Agent 编写单元测试、端到端测试、测试计划或根据失败日志定位问题。
  • 使用时需要确认项目测试框架、运行命令和夹具数据,避免为了通过测试而改坏真实逻辑。
  • 涉及浏览器或外部服务时,应区分本地模拟、测试环境和生产环境。
  • run-playwright 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Playwright CLI

Use @anthropic-ai/playwright-cli to drive a live browser from the terminal. Keep this file focused on trigger logic, workflow, guardrails, and reference routing. Use references/ for detailed commands, edge cases, and larger patterns.

Invocation model — read this first. playwright-cli is a command-per-invocation CLI backed by persistent session state. Run each action from the shell as its own command, for example playwright-cli tab-list, playwright-cli open https://example.com, playwright-cli snapshot. There is no required > prompt workflow in the shipped CLI.

Trigger boundary

Use this skill when the task requires a real browser session and interactive CLI control:

  • open pages, navigate, and verify what actually rendered
  • fill forms, upload files, submit flows, and prove the result
  • manage tabs, popups, or session state during a live run
  • collect screenshots, console logs, network logs, or traces as evidence
  • use short run-code snippets only when the CLI lacks a direct command

Do not use this skill when:

  • the job is writing or reviewing Playwright test code instead of driving the CLI
  • plain HTTP fetching or static scraping is enough
  • the site needs Browserbase-style hosted browsing, anti-bot bypass, or remote browser routing; prefer run-agent-browser

Non-negotiable rules

  1. Prefer the current browser context when it already has the right state. Do not reset sessions or reinstall tools just because a browser exists.
  2. Prefer a new tab over a new window. Use a popup or new window only when the site forces one, such as OAuth or target=_blank flows.
  3. Keep a running tab map in your notes: index -> purpose -> expected URL/state. Refresh it after every tab-new, tab-close, tab-select, or popup event.
  4. Verify the active tab before every action. Use tab-list, tab-select if needed, eval "() => window.location.href", then snapshot.
  5. Follow observe -> act -> verify. Never chain blind actions across unknown state.
  6. Treat refs as disposable. Re-snapshot after navigation, SPA rerender, submission, tab switch, popup handling, or run-code.
  7. Use CLI commands first. Reach for run-code only for waits, popups, downloads, iframes/shadow DOM, or missing primitives; then immediately re-enter the snapshot loop.
  8. Treat screenshots as evidence, not default observation. Use snapshot for structure, eval for truth, screenshots for visual proof.
  9. Clean up only what you created. Close transient tabs and temporary sessions, but do not destroy shared or pre-existing contexts.

Recommended workflow

1) Attach or bootstrap

Only bootstrap when the CLI or browser support is missing:

which playwright-cli || npm install -g @anthropic-ai/playwright-cli@latest
playwright-cli install --browser=chrome   # always run — ensures browser binary exists
Steering experience: Always run playwright-cli install --browser=chrome even if the CLI is already installed. It is a no-op when the binary exists, but skipping it causes cryptic "browser not found" errors when the binary is missing. This is a one-second check that prevents a five-minute debug session.

When you need an isolated session (parallel work, risky experiments), add to bootstrap:

playwright-cli config --isolated
playwright-cli session-list
  • If an existing session or tab already contains the needed login or state, inspect it first instead of resetting everything.
  • Start a named session or isolated browser only when you need clean-room state, parallel isolation, or risky experimentation; use references/tabs.md for the exact bootstrap patterns.
  • For isolated scratch work, stop the session you created at cleanup time: use session-stop for the current unnamed isolated session or session-stop <name> for a named one.
  • Do not begin with session-stop-all unless you intentionally want to discard every active browser.
  • Session state persists behind the CLI. Inspect it with playwright-cli session-list. Artifacts such as snapshots, console output, and screenshots are usually written under .playwright-cli/ relative to the shell working directory; the printed path is the source of truth.

2) Establish tab and session ground truth

  • Run tab-list.
  • Decide whether to reuse the current tab or open a temporary work tab.
  • When you need a new work surface, use tab-new first and open <url> second.
  • For local fixtures, do not assume file://, localhost, or LAN URLs are reachable from the browser context. If open file:///... is blocked or open http://127.0.0.1:... fails from the session, switch to one of these paths:

- use a data: URL for a tiny self-contained fixture - expose the page on a publicly reachable staging/tunnel URL - stop and tell the user the current browser context cannot reach the local target

Steering experience: Do NOT use tab-new <url>. It is documented but unreliable — in testing it frequently opens about:blank instead of the requested URL. The safe two-step pattern is tab-new then open <url>.
  • Record the tab map before you continue.
  • If a popup or forced new window is expected, route to references/tabs.md before acting.

3) Observe before touching the page

Steering experience: snapshot writes a YAML accessibility-tree file to .playwright-cli/page-<timestamp>.yml and prints the file path, not the tree content. You must cat the file to read the actual refs. Example flow: ``bash playwright-cli snapshot # prints: Snapshot saved to .playwright-cli/page-1710456789.yml cat .playwright-cli/page-1710456789.yml # read the YAML to find refs like e0, e1, e5 ``

Use the cheapest command that gives trustworthy state:

playwright-cli snapshot
playwright-cli eval "() => window.location.href"

Add only the extra proof you need:

  • playwright-cli screenshot --filename=... for layout, visual regressions, or before/after evidence
  • playwright-cli eval "() => document.title" or more specific eval checks when correctness matters
  • playwright-cli console error and playwright-cli network when diagnosing failures or proving backend behavior
  • Treat playwright-cli eval "() => window.location.href" as the URL source of truth. The CLI's printed page metadata can lag or report about:blank after odd tab/navigation flows.

4) Act with the smallest direct command

The CLI has far more commands than just click and fill. Here is the task-focused command surface for this skill:

CategoryCommandsReference
Navigationopen, reload, go-back, go-forwardreferences/navigation.md
Inputsfill, fill --submit, type, type --submit, select, check, uncheckreferences/forms.md
Click / hoverclick, dblclick, hoverreferences/selectors.md
Keyboardpress <Key> (e.g., press Enter, press Tab, press Escape)references/forms.md
Viewportresize <w> <h>, mousewheel <deltaX> <deltaY>references/screenshots.md
Filesupload /absolute/path/to/file (file chooser must be active first)references/forms.md
Tabstab-new, tab-list, tab-select <i>, tab-close [i]references/tabs.md
Dialogsdialog-accept [text], dialog-dismissreferences/tabs.md
Screenshotsscreenshot [--full-page] [--filename=...], screenshot <ref>references/screenshots.md
PDFpdf --filename=...references/screenshots.md
Videovideo-start, video-stopreferences/screenshots.md
Observationsnapshot, eval "() =>...", eval "(el) =>..." <ref>references/selectors.md
Debug`console [error\warning\info], console --clear, network [--static], network --clear`references/debugging.md
Tracingtracing-start, tracing-stopreferences/debugging.md
Sessionssession-list, session-stop [name], session-stop-all, session-restart [name]references/tabs.md
Coderun-code 'async (page) => {...}'references/selectors.md

For session reuse, persisted auth, cookie/storage inspection, downloads, and route mocking, use references/patterns.md. The current CLI build handles those cases through named sessions, eval, and run-code, not dedicated state-save, cookie-*, localstorage-*, sessionstorage-*, or route shell subcommands.

Use direct commands with these rules:

  • use check for radios and checkboxes when possible; it is safer than blind click
  • after fill, select, or check, verify the live value with eval
  • for uploads, trigger the file chooser first, then call upload
  • if the page needs a wait, wait for a selector, URL, or response with run-code, then snapshot
Steering experience: The mousewheel <deltaX> <deltaY> parameter order may be swapped in some CLI versions (deltaY first, deltaX second). Always test with a small value first and verify with eval "() => window.scrollY" before relying on large scroll distances. See references/screenshots.md for details.

5) Verify immediately after each meaningful action

Steering experience: All artifact commands (console, network, snapshot, screenshot) write results to files, not to stdout. The CLI prints the file path; you must cat or inspect that file to see actual content. Never assume the page is clean or broken based on command output alone — always read the artifact file. Likewise, do not trust the header-style "Page URL" line over eval "() => window.location.href".

Use the lightest proof that actually confirms success:

GoalMinimum proof
Navigation or redirect workedeval "() => window.location.href" + snapshot
Form field changedeval "(el) => el.value" <ref> or eval "(el) => el.checked" <ref>
Upload succeededeval file list + screenshot if the UI must show the file
Visual state mattersscreenshot with descriptive filename + state proof
A bug or regression is suspectedconsole --clear / network --clear, reproduce, then cat returned artifact files
Steering experience: console --clear and network --clear produce no visible output — they succeed silently. This is expected behavior, not an error. Do not re-run them thinking they failed.

Use progressively stronger evidence when risk increases:

  1. State proofsnapshot + eval
  2. Behavior proof — state proof + action-specific assertion
  3. Visual proof — behavior proof + screenshot(s)
  4. Diagnosis proof — visual/state proof + console, network, or tracing artifacts

Do this, not that

Do thisNot that
Reuse a good existing tab or session when it already has the right stateReset or isolate by default
tab-new then open <url>tab-new <url> (unreliable — may open about:blank)
Keep a live tab map and confirm the active tab before each actionAssume tab indexes and URLs stayed the same
snapshotcat <file> to read refs, and re-snapshot after page changesReuse old refs after navigation or rerender
eval for URL, value, checked state, counts, and ready stateTrust headers or command echo alone
check or uncheck for radios and checkboxesBlind click on stateful inputs
Click the upload trigger, then upload /absolute/path/...Call upload before the chooser is active
cat the file returned by console or network to inspect artifactsAssume the command output alone proves anything
Use run-code only for waits or missing primitives, then snapshotStay in custom code longer than necessary
Close transient tabs when finishedLeave disposable tabs or scratch sessions behind
Run playwright-cli install --browser=chrome every time during bootstrapSkip it and assume browser binary exists
Test mousewheel with a small value + eval "() => window.scrollY" firstAssume parameter order is correct

Recovery rules

If the workflow drifts, recover in this order:

  1. Unsure which tab is activetab-list, tab-select, eval "() => window.location.href", snapshot
  2. Ref not found or action did nothing — re-snapshot (snapshotcat <file>), then retry with fresh refs
  3. SPA or lazy UI did not settle — use run-code to wait for a selector, URL, or response, then snapshot
  4. Popup or new window appeared — handle it via references/tabs.md, then re-verify the main tab before continuing
  5. Form or upload state is uncleareval live values or files; do not infer from command success
  6. Bug evidence is weakconsole --clear (silent), network --clear (silent), reproduce once, cat artifact files, then capture a screenshot
  7. You used run-code — assume refs are dead and rebuild state with snapshot
  8. mousewheel scrolled wrong direction — try swapping deltaX/deltaY parameters; verify with eval "() => window.scrollY"
  9. --clear seemed to fail — it didn't; --clear produces no output by design

Reference routing

Read only what matches the current job:

NeedReference
Page loads, redirects, waits, SPA navigation, URL verificationreferences/navigation.md
Inputs, selects, radios, uploads, date pickers, multi-step forms, submission proofreferences/forms.md
Screenshots, responsive checks, dark mode, before/after comparisons, layout integrityreferences/screenshots.md
Tabs, named sessions, popups, shared-session work, cleanup boundariesreferences/tabs.md
Console/network artifacts, tracing, truth checks, diagnosis workflow, troubleshootingreferences/debugging.md
Refs, eval usage, extraction, CSS fallback, iframes, shadow DOM, run-code selectorsreferences/selectors.md
Login, search and filter, downloads, storage, multi-step flows, E2E verification levelsreferences/patterns.md

Common starting points

  • Navigate and verify a pagereferences/navigation.md
  • Fill, submit, and prove a formreferences/forms.md and references/debugging.md if submit is flaky
  • Work across multiple tabs or popupsreferences/tabs.md
  • Collect visual proofreferences/screenshots.md
  • Diagnose why something failedreferences/debugging.md
  • Run a full workflow such as login or downloadreferences/patterns.md

Cleanup

When browser work ends:

  • close transient tabs you opened for the task
  • stop or delete only the scratch sessions you created — use session-stop for the current isolated session or session-stop <name> for a named one
  • keep shared or preexisting sessions alive unless the user asked for teardown
  • if you collected evidence, preserve the returned artifact paths in your answer

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

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

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

平台分布

Codex

34.99%
按下载量换算55

Claude

29.84%
按下载量换算47

Cursor

19.28%
按下载量换算30

Gemini CLI

8.71%
按下载量换算14

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

操作浏览器

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

安装前确认

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

来源信息

继续浏览同类 Skills