官方Microsoft Playwright CLI网页自动化工具,支持所有主流浏览器的无头/有头自动化操作,包括页面导航、元素交互、截图、录制、测试等功能。当用户提到网页自动化、浏览器操作、爬虫、截图、录制用户操作、E2E测试时触发。
数据来源:ClawHub。 在 ClawSkills 查看
选择你使用的 Agent
方法一:命令行安装(推荐)
推荐(无需提前安装 clawhub)
npx clawhub@latest --dir ~/.claude/skills install playwright-cli-openclaw或使用 clawhub CLI(需提前安装)
clawhub --dir ~/.claude/skills install playwright-cli-openclaw⚠️ 需要 Node.js 18+,没有 Node?请使用下方方法二直接下载 ZIP。 安装 Node.js →
方法二:手动下载安装(无需 Node)
下载 ZIP,解压后将文件夹放到以下路径,重启 Agent 即可:
安装路径
~/.claude/skills/playwright-cli-openclaw/💡解压后将文件夹放到上方路径,重启 Agent 即可生效
--- name: playwright-cli description: 官方Microsoft Playwright CLI网页自动化工具,支持所有主流浏览器的无头/有头自动化操作,包括页面导航、元素交互、截图、录制、测试等功能。当用户提到网页自动化、浏览器操作、爬虫、截图、录制用户操作、E2E测试时触发。 ---
Playwright CLI是微软官方的浏览器自动化工具,支持Chromium、Firefox、WebKit三大主流浏览器,提供强大的网页自动化能力。
npm install -g @playwright/test
# 或者
pip install playwright
playwright install
# 仅安装特定浏览器
playwright install chromium firefox
# 安装系统依赖(Linux环境)
playwright install-deps
# 打开指定网页
playwright open https://example.com
# 无头模式打开网页并截图
playwright screenshot https://example.com example.png
# 全屏截图
playwright screenshot https://example.com --full-page full.png
# 指定视口大小
playwright screenshot https://example.com --viewport-size=1920,1080 desktop.png
# 生成PDF
playwright pdf https://example.com example.pdf
# 自定义PDF格式
playwright pdf https://example.com --format=A4 --landscape report.pdf
# 录制用户操作并生成代码
playwright codegen https://example.com
# 保存录制结果到文件
playwright codegen https://example.com --output script.py
# 生成指定语言的代码(python, javascript, java, csharp)
playwright codegen https://example.com --target python
# 运行测试
playwright test
# 运行特定测试文件
playwright test tests/example.spec.js
# 有头模式运行测试(显示浏览器界面)
playwright test --headed
# 调试模式运行
playwright test --debug
# 生成测试报告
playwright show-report
# 列出已安装的浏览器
playwright list-browsers
# 更新浏览器到最新版本
playwright install --force
# 卸载浏览器
playwright uninstall chromium
# 对多个网页进行全屏截图
for url in "https://google.com" "https://github.com" "https://stackoverflow.com"; do
name=$(echo $url | sed 's/https\?:\/\///' | sed 's/\//_/g')
playwright screenshot $url --full-page "${name}.png"
done
# 录制生成的自动登录脚本示例
from playwright.sync_api import Playwright, sync_playwright, expect
def run(playwright: Playwright) -> None:
browser = playwright.chromium.launch(headless=False)
context = browser.new_context()
page = context.new_page()
page.goto("https://example.com/login")
page.get_by_label("用户名").fill("your_username")
page.get_by_label("密码").fill("your_password")
page.get_by_role("button", name="登录").click()
# 截图登录后的页面
page.screenshot(path="logged_in.png")
context.close()
browser.close()
with sync_playwright() as playwright:
run(playwright)
# 模拟iPhone 14访问网页并截图
playwright screenshot https://example.com --device="iPhone 14" mobile.png
# 模拟安卓设备
playwright screenshot https://example.com --device="Galaxy S23" android.png
codegen录制生成代码,再手动调整--slowmo=1000参数减慢操作速度,避免被反爬--save-storage=auth.json,下次可以直接--load-storage=auth.json跳过登录--timeout=60000延长超时时间安装 Playwright CLI Automation 后,可以对 AI 说这些话来触发它
Help me get started with Playwright CLI Automation
Explains what Playwright CLI Automation does, walks through the setup, and runs a quick demo based on your current project
Use Playwright CLI Automation to the official Microsoft Playwright CLI web page automation tool supp...
Invokes Playwright CLI Automation with the right parameters and returns the result directly in the conversation
What can I do with Playwright CLI Automation in my ai agent & automation workflow?
Lists the top use cases for Playwright CLI Automation, with example commands for each scenario
将技能文件夹放到 ~/.claude/skills/playwright-cli-openclaw/ 目录(个人级,所有项目可用),或 .claude/skills/playwright-cli-openclaw/(项目级)。重启 AI 客户端后,用 /playwright-cli-openclaw 主动调用,或让 AI 根据上下文自动发现并使用。
Playwright CLI Automation 支持 Claude、Cursor、OpenClaw,可与这些 AI 平台无缝集成,扩展其能力。
Playwright CLI Automation 可免费安装使用。请查阅仓库了解许可证信息。
官方Microsoft Playwright CLI网页自动化工具,支持所有主流浏览器的无头/有头自动化操作,包括页面导航、元素交互、截图、录制、测试等功能。当用户提到网页自动化、浏览器操作、爬虫、截图、录制用户操作、E2E测试时触发。
Playwright CLI Automation 属于「AI Agent & Automation」分类,该分类的技能帮助 AI 智能体在此领域执行专业任务。
Automate my ai agent & automation tasks using Playwright CLI Automation
Identifies repetitive steps in your workflow and sets up Playwright CLI Automation to handle them automatically