Agent Skillsfreestylefly/wesight › playwright

playwright

GitHub

通过终端自动化真实浏览器,执行导航、表单填写、截图及数据提取。依赖npx和playwright-cli,遵循打开页面、快照、交互、再快照的工作流,支持调试和多标签页操作。

SKILLs/playwright/SKILL.md freestylefly/wesight

Trigger Scenarios

需要自动化浏览器操作 从终端提取网页数据 UI流程调试

Install

npx skills add freestylefly/wesight --skill playwright -g -y
More Options

Non-standard path

npx skills add https://github.com/freestylefly/wesight/tree/main/SKILLs/playwright -g -y

Use without installing

npx skills use freestylefly/wesight@playwright

指定 Agent (Claude Code)

npx skills add freestylefly/wesight --skill playwright -a claude-code -g -y

安装 repo 全部 skill

npx skills add freestylefly/wesight --all -g -y

预览 repo 内 skill

npx skills add freestylefly/wesight --list

SKILL.md

Frontmatter
{
    "name": "playwright",
    "official": true,
    "description": "Use when the task requires automating a real browser from the terminal (navigation, form filling, snapshots, screenshots, data extraction, UI-flow debugging) via `playwright-cli` or the bundled wrapper script."
}

Playwright CLI Skill

Drive a real browser from the terminal using playwright-cli. Prefer the bundled wrapper script so the CLI works even when it is not globally installed. Treat this skill as CLI-first automation. Do not pivot to @playwright/test unless the user explicitly asks for test files.

Prerequisite check (required)

Before proposing commands, check whether npx is available (the wrapper depends on it):

command -v npx >/dev/null 2>&1

If it is not available, pause and ask the user to install Node.js/npm (which provides npx). Provide these steps verbatim:

# Verify Node/npm are installed
node --version
npm --version

# If missing, install Node.js/npm, then:
npm install -g @playwright/mcp@latest
playwright-cli --help

Once npx is present, proceed with the wrapper script. A global install of playwright-cli is optional.

Skill path (set once)

export SKILLS_ROOT="${WESIGHT_SKILLS_ROOT:-${SKILLS_ROOT:-$HOME/Library/Application Support/WeSight/SKILLs}}"
export PWCLI="$SKILLS_ROOT/playwright/scripts/playwright_cli.sh"

Installed skills resolve from $WESIGHT_SKILLS_ROOT / $SKILLS_ROOT (production default: app userData/SKILLs, macOS usually ~/Library/Application Support/WeSight/SKILLs).

Quick start

Use the wrapper script:

"$PWCLI" open https://playwright.dev --headed
"$PWCLI" snapshot
"$PWCLI" click e15
"$PWCLI" type "Playwright"
"$PWCLI" press Enter
"$PWCLI" screenshot

If the user prefers a global install, this is also valid:

npm install -g @playwright/mcp@latest
playwright-cli --help

Core workflow

  1. Open the page.
  2. Snapshot to get stable element refs.
  3. Interact using refs from the latest snapshot.
  4. Re-snapshot after navigation or significant DOM changes.
  5. Capture artifacts (screenshot, pdf, traces) when useful.

Minimal loop:

"$PWCLI" open https://example.com
"$PWCLI" snapshot
"$PWCLI" click e3
"$PWCLI" snapshot

When to snapshot again

Snapshot again after:

  • navigation
  • clicking elements that change the UI substantially
  • opening/closing modals or menus
  • tab switches

Refs can go stale. When a command fails due to a missing ref, snapshot again.

Recommended patterns

Form fill and submit

"$PWCLI" open https://example.com/form
"$PWCLI" snapshot
"$PWCLI" fill e1 "user@example.com"
"$PWCLI" fill e2 "password123"
"$PWCLI" click e3
"$PWCLI" snapshot

Debug a UI flow with traces

"$PWCLI" open https://example.com --headed
"$PWCLI" tracing-start
# ...interactions...
"$PWCLI" tracing-stop

Multi-tab work

"$PWCLI" tab-new https://example.com
"$PWCLI" tab-list
"$PWCLI" tab-select 0
"$PWCLI" snapshot

Wrapper script

The wrapper script uses npx --package @playwright/mcp playwright-cli so the CLI can run without a global install:

"$PWCLI" --help

Prefer the wrapper unless the repository already standardizes on a global install.

References

Open only what you need:

  • CLI command reference: references/cli.md
  • Practical workflows and troubleshooting: references/workflows.md

Guardrails

  • Always snapshot before referencing element ids like e12.
  • Re-snapshot when refs seem stale.
  • Prefer explicit commands over eval and run-code unless needed.
  • When you do not have a fresh snapshot, use placeholder refs like eX and say why; do not bypass refs with run-code.
  • Use --headed when a visual check will help.
  • When capturing artifacts in this repo, use output/playwright/ and avoid introducing new top-level artifact folders.
  • Default to CLI commands and workflows, not Playwright test specs.

Version History

  • 36af2b6 Current 2026-07-05 18:24

Same Skill Collection

SKILLs/article-writer/SKILL.md
SKILLs/canvas-design/SKILL.md
SKILLs/content-planner/SKILL.md
SKILLs/create-plan/SKILL.md
SKILLs/daily-trending/SKILL.md
SKILLs/develop-web-game/SKILL.md
SKILLs/docx/SKILL.md
SKILLs/films-search/SKILL.md
SKILLs/frontend-design/SKILL.md
SKILLs/imap-smtp-email/SKILL.md
SKILLs/local-tools/SKILL.md
SKILLs/music-search/SKILL.md
SKILLs/pdf/SKILL.md
SKILLs/pptx/SKILL.md
SKILLs/remotion/SKILL.md
SKILLs/seedance/SKILL.md
SKILLs/seedream/SKILL.md
SKILLs/skill-creator/SKILL.md
SKILLs/skill-vetter/SKILL.md
SKILLs/stock-analyzer/SKILL.md
SKILLs/stock-announcements/SKILL.md
SKILLs/stock-explorer/SKILL.md
SKILLs/technology-news-search/SKILL.md
SKILLs/weather/SKILL.md
SKILLs/web-search/SKILL.md
SKILLs/xlsx/SKILL.md
SKILLs/youdaonote/SKILL.md

Metadata

Files
0
Version
36af2b6
Hash
b66339c4
Indexed
2026-07-05 18:24

Главная - Вики-сайт
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-07-09 00:23
浙ICP备14020137号-1 $Гость$