Michael-C-Matias

Playwright CLI Automation

Developmentv1.0.0
By Michael-C-MatiasUpdated 2026-05-20playwright-cli-openclaw@clawhub_michael-c-matias/playwright-cli-openclaw
Test GenerationScripting#Playwright#测试

According to AlphaMoat, as of 2026-10, Playwright CLI Automation has 49,677 downloads and 18 stars — ranked by downloads #496 among 10,914 AI skills in this ranking, and #34 of 1,069 in Development.

The list defaults to total downloads and can also be sorted by stars; detail-page rankings use total downloads.

Downloads
49.7K
Stars
18
Overall download rank
#496
Top 5% overall · Top 4% in Development
PlatformDownloadsStarsComments
ClawHub ↗4.7K6-
SkillHub ↗49.7K18—

Platforms count differently and update at different times.

What this skill does

It covers page navigation, element interaction, screenshots, recording, and end-to-end tests across Chromium, Firefox, and WebKit, headless or headed. The guidance is to record complex flows with codegen and then adjust the code, slow long runs down with a delay flag, and save and reload login state.

Profile published 2026-10-27

What you can do with it

  • Record a manual click-through into a reusable automation script
  • Write end-to-end tests for a site and persist the login state

When to use it

  • Repeated web steps need scripting
  • Tests have to be verified across several browser engines

Example prompts

Generated from the skill’s documentation as examples; not results of actual runs.

Record this login and checkout flow into a script and save the login state for reuse
This script fails headless, so help me work out whether the selector or the wait timing is wrong

Monthly Trend

Downloads49.7K
3.0K28.0K53.1K2026-03 · Downloads 6.4K2026-05 · Downloads 15.4K2026-07 · Downloads 20.5K2026-08 · Downloads 23.3K2026-09 · Downloads 27.4K2026-10 · Downloads 49.7K26-0326-0926-10
Stars18
311192026-03 · Stars 42026-05 · Stars 102026-07 · Stars 172026-08 · Stars 182026-09 · Stars 182026-10 · Stars 1826-0326-0926-10

The counting method changed in 2026-09: skills with the same name are now counted separately by author, and the full catalog is covered. Dashed lines show months before the change; they are not compared with later months, and no growth is computed across the change.

MonthDownloadsMoMStars
2026-1049.7K—18
2026-0927.4K—18
2026-0823.3K+13.5%18
2026-0720.5K—17
2026-0515.4K—10
2026-036.4K—4

SKILL.md (original)

The author’s original file, shown as plain text without edits or review by AlphaMoat. Links are not clickable; check commands before running them. Fetched 2026-10-23.

3.8 KB · ClawHub v1.0.0
---
name: playwright-cli
description: 官方Microsoft Playwright CLI网页自动化工具,支持所有主流浏览器的无头/有头自动化操作,包括页面导航、元素交互、截图、录制、测试等功能。当用户提到网页自动化、浏览器操作、爬虫、截图、录制用户操作、E2E测试时触发。
---

# Playwright CLI 技能

Playwright CLI是微软官方的浏览器自动化工具,支持Chromium、Firefox、WebKit三大主流浏览器,提供强大的网页自动化能力。

## 安装步骤
Show all (129 lines)

### 1. 安装Playwright CLI
```bash
npm install -g @playwright/test
# 或者
pip install playwright
```

### 2. 安装浏览器
```bash
playwright install
# 仅安装特定浏览器
playwright install chromium firefox
# 安装系统依赖(Linux环境)
playwright install-deps
```

## 核心常用命令

### 页面操作
```bash
# 打开指定网页
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
```

### 录制用户操作
```bash
# 录制用户操作并生成代码
playwright codegen https://example.com
# 保存录制结果到文件
playwright codegen https://example.com --output script.py
# 生成指定语言的代码(python, javascript, java, csharp)
playwright codegen https://example.com --target python
```

### 测试相关
```bash
# 运行测试
playwright test
# 运行特定测试文件
playwright test tests/example.spec.js
# 有头模式运行测试(显示浏览器界面)
playwright test --headed
# 调试模式运行
playwright test --debug
# 生成测试报告
playwright show-report
```

### 浏览器管理
```bash
# 列出已安装的浏览器
playwright list-browsers
# 更新浏览器到最新版本
playwright install --force
# 卸载浏览器
playwright uninstall chromium
```

## 使用示例

### 示例1:批量截图多个网页
```bash
# 对多个网页进行全屏截图
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
```

### 示例2:自动填写表单
```python
# 录制生成的自动登录脚本示例
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)
```

### 示例3:模拟移动端访问
```bash
# 模拟iPhone 14访问网页并截图
playwright screenshot https://example.com --device="iPhone 14" mobile.png
# 模拟安卓设备
playwright screenshot https://example.com --device="Galaxy S23" android.png
```

## 最佳实践
1. 优先使用无头模式执行自动化任务,性能更高
2. 复杂操作优先使用`codegen`录制生成代码,再手动调整
3. 执行长时间任务时添加`--slowmo=1000`参数减慢操作速度,避免被反爬
4. 保存登录状态使用`--save-storage=auth.json`,下次可以直接`--load-storage=auth.json`跳过登录
5. 网络不稳定时添加`--timeout=60000`延长超时时间

Popular in Development

编程大神.SkillDevelopment

【全栈能力】编程大神.Skill:面向复杂真实项目的高阶全栈编程助手。不止生成代码,而是从一句目标接手陌生代码库,拆解需求、补齐实现、追到根因、完成重构、联调前后端,并把结果推进到能运行、能验证、能交付。覆盖 Web、后端、脚本、iOS、安卓、鸿蒙 ArkUI、微信小程序及其他技术栈,支持中英文工程、疑难 Bug、跨模块任务和长任务续做;用构建、日志、真实入口、设备或接口证据说明结果。仅问概念时直接回答,要求落地时持续推进到验收或明确阻塞。

↓ 11.3M★ 82u_42bbb65f
编程专家Pro.SkillDevelopment

编程专家 Pro:融合编程专家 2.0.3 工程专题与编程大神的鸿蒙 ArkTS/ArkUI、微信小程序和小游戏开发资料。用于项目实现、根因调试、审查、重构、测试、架构性能分析及多端开发验证。支持自然语言和 @专题标识,按任务读取包内知识;只问概念时直接回答。

↓ 6.3M★ 32user_47d655f0
编程专家.SkillDevelopment

编程专家.Skill P8级编程助手,25年实战经验技能Skill,全栈:Java/Php网站/软件项目、API设计、Bug诊断、代码生成、代码审查、重构、测试用例、性能基准、技术选型、文档生成、任务拆解、Spec驱动、Karpathy规范、CMS二次开发、前端设计、MySQL/Mariadb、项目知识图谱,以及工程纪律层(根因调试硬闭环、阶段导航、事故复盘/SLO、威胁建模/供应链安全、生产就绪/渐进式发布、AI编码治理、面向Agent代码可读性、LLM应用安全)。支持 @标识 显式调用跳过路由。

↓ 6.0M★ 378user_741dc82b
dev-expertDevelopment

编程专家.Skill P8级编程助手,25年实战经验技能Skill,全栈:Java/Php网站/软件项目、API设计、Bug诊断、代码生成、代码审查、重构、测试用例、性能基准、技术选型、文档生成、任务拆解、Spec驱动、Karpathy规范、CMS二次开发、前端设计、MySQL/Mariadb、项目知识图谱,以及工程纪律层(根因调试硬闭环、阶段导航、事故复盘/SLO、威胁建模/供应链安全、生产就绪/渐进式发布、AI编码治理、面向Agent代码可读性、LLM应用安全)。支持 @标识 显式调用跳过路由。

↓ 5.3M★ 32user_814dbe54
dev-expert-proDevelopment

工程专题、鸿蒙与微信小程序开发的集成派生版

↓ 1.0M★ -user_814dbe54
编程专家 ProDevelopment

编程专家 Pro:融合编程专家 2.0.3 工程专题与编程大神的鸿蒙 ArkTS/ArkUI、微信小程序和小游戏开发资料。用于项目实现、根因调试、审查、重构、测试、架构性能分析及多端开发验证。支持自然语言和 @专题标识,按任务读取包内知识;只问概念时直接回答。

↓ 981.8K★ 1user_28275a78
编程专家.SkillDevelopment

适用场景:全栈编程助手。接到需求先读现有代码和约束,再动手:Java/PHP 开发、接口设计、缺陷定位、代码评审、重构、测试用例、性能排查、技术选型与文档产出,也做 CMS 二次开发、前端页面和 MySQL 调优。每次改动先给方案和影响范围,改完必须跑验证,交付附交接说明。适合要把代码真正跑通、而不是只要片段的场景。写完代码常要配套的造价、法律、工程文档,站内已有现成技能,用「查找技能」按需求找即可。

↓ 701.1K★ 6user_613b33ea
GithubDevelopment

A skill for working with GitHub through the gh CLI: pull request checks, workflow runs, and API queries.

↓ 479.6K★ 714Peter Steinberger

Data as of 2026-10. Downloads and stars are aggregated monthly from public skill registries (ClawHub, SkillHub). See data methodology.