playwright by davila7/claude-code-templates
npx skills add https://github.com/davila7/claude-code-templates --skill playwright使用 playwright-cli 在终端中驱动真实浏览器。优先使用捆绑的包装脚本,这样即使 CLI 未全局安装也能正常工作。将此技能视为 CLI 优先的自动化工具。除非用户明确要求测试文件,否则不要转向 @playwright/test。
在建议命令之前,检查 npx 是否可用(包装脚本依赖它):
command -v npx >/dev/null 2>&1
如果不可用,请暂停并提示用户安装 Node.js/npm(它提供 npx)。原样提供以下步骤:
# 验证 Node/npm 是否已安装
node --version
npm --version
# 如果缺失,安装 Node.js/npm,然后:
npm install -g @playwright/cli@latest
playwright-cli --help
一旦 npx 存在,即可使用包装脚本。全局安装 playwright-cli 是可选的。
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
export CODEX_HOME="${CODEX_HOME:-$HOME/.codex}"
export PWCLI="$CODEX_HOME/skills/playwright/scripts/playwright_cli.sh"
用户作用域内的技能安装在 $CODEX_HOME/skills 下(默认:~/.codex/skills)。
使用包装脚本:
"$PWCLI" open https://playwright.dev --headed
"$PWCLI" snapshot
"$PWCLI" click e15
"$PWCLI" type "Playwright"
"$PWCLI" press Enter
"$PWCLI" screenshot
如果用户偏好全局安装,这也是有效的:
npm install -g @playwright/cli@latest
playwright-cli --help
最小循环:
"$PWCLI" open https://example.com
"$PWCLI" snapshot
"$PWCLI" click e3
"$PWCLI" snapshot
在以下情况后再次快照:
引用可能会过时。当命令因引用缺失而失败时,请再次快照。
"$PWCLI" open https://example.com/form
"$PWCLI" snapshot
"$PWCLI" fill e1 "user@example.com"
"$PWCLI" fill e2 "password123"
"$PWCLI" click e3
"$PWCLI" snapshot
"$PWCLI" open https://example.com --headed
"$PWCLI" tracing-start
# ...交互...
"$PWCLI" tracing-stop
"$PWCLI" tab-new https://example.com
"$PWCLI" tab-list
"$PWCLI" tab-select 0
"$PWCLI" snapshot
包装脚本使用 npx --package @playwright/cli playwright-cli,因此 CLI 无需全局安装即可运行:
"$PWCLI" --help
除非仓库已标准化为全局安装,否则优先使用包装脚本。
仅打开你需要的部分:
references/cli.mdreferences/workflows.mde12 这样的元素 ID 之前,始终先快照。eval 和 run-code。eX 并说明原因;不要用 run-code 绕过引用。--headed。output/playwright/ 并避免引入新的顶级工件文件夹。每周安装量
88
仓库
GitHub 星标数
22.6K
首次出现
2026年2月8日
安全审计
安装于
gemini-cli87
amp87
github-copilot87
opencode87
codex87
kimi-cli87
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.
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/cli@latest
playwright-cli --help
Once npx is present, proceed with the wrapper script. A global install of playwright-cli is optional.
export CODEX_HOME="${CODEX_HOME:-$HOME/.codex}"
export PWCLI="$CODEX_HOME/skills/playwright/scripts/playwright_cli.sh"
User-scoped skills install under $CODEX_HOME/skills (default: ~/.codex/skills).
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/cli@latest
playwright-cli --help
Minimal loop:
"$PWCLI" open https://example.com
"$PWCLI" snapshot
"$PWCLI" click e3
"$PWCLI" snapshot
Snapshot again after:
Refs can go stale. When a command fails due to a missing ref, snapshot again.
"$PWCLI" open https://example.com/form
"$PWCLI" snapshot
"$PWCLI" fill e1 "user@example.com"
"$PWCLI" fill e2 "password123"
"$PWCLI" click e3
"$PWCLI" snapshot
"$PWCLI" open https://example.com --headed
"$PWCLI" tracing-start
# ...interactions...
"$PWCLI" tracing-stop
"$PWCLI" tab-new https://example.com
"$PWCLI" tab-list
"$PWCLI" tab-select 0
"$PWCLI" snapshot
The wrapper script uses npx --package @playwright/cli 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.
Open only what you need:
references/cli.mdreferences/workflows.mde12.eval and run-code unless needed.eX and say why; do not bypass refs with run-code.--headed when a visual check will help.output/playwright/ and avoid introducing new top-level artifact folders.Weekly Installs
88
Repository
GitHub Stars
22.6K
First Seen
Feb 8, 2026
Security Audits
Gen Agent Trust HubFailSocketPassSnykFail
Installed on
gemini-cli87
amp87
github-copilot87
opencode87
codex87
kimi-cli87
Skills CLI 使用指南:AI Agent 技能包管理器安装与管理教程
43,100 周安装
Kimodo Motion Diffusion:基于文本和约束生成3D人体与机器人运动 | AI运动生成模型
489 周安装
AI广告文案生成器 - 为Google Ads、Meta、TikTok、LinkedIn创建高转化广告文案
497 周安装
Tailwind CSS 最佳实践指南 | Mastra AI 官方样式规范与组件库使用规则
498 周安装
WhatsApp Business API自动化指南:聊天机器人、客户支持与通知模板
497 周安装
BrowserStack Playwright 集成指南:云端跨浏览器自动化测试配置与运行
511 周安装
Claude技能:promote - 将AI学习成果转化为项目规则,提升开发效率与代码一致性
519 周安装