playwright-cli
15,131
Stars
914
Forks
53
Watchers
2
Open Issues
Apache-2.0
许可证
TypeScript
语言
2020-06-19
创建时间
2026-11-11
最近更新
项目能做什么
Playwright 命令行工具,支持录制生成代码、检查选择器与网页截图。
来源:AI 基于仓库事实生成
· 内容以仓库实际 README 为准
使用说明 查看原始 README 原仓库文档
中文使用说明暂未生成。下面保留原仓库 README 摘录,命令与配置均以原文为准。
原始 README 摘录(英文原文,节选前 3000 字符)
# playwright-cli
Playwright CLI with SKILLS
### Playwright CLI vs Playwright MCP
This package provides CLI interface into Playwright. If you are using **coding agents**, that is the best fit.
- **CLI**: Modern **coding agents** increasingly favor CLI–based workflows exposed as SKILLs over MCP because CLI invocations are more token-efficient: they avoid loading large tool schemas and verbose accessibility trees into the model context, allowing agents to act through concise, purpose-built commands. This makes CLI + SKILLs better suited for high-throughput coding agents that must balance browser automation with large codebases, tests, and reasoning within limited context windows.
- **MCP**: MCP remains relevant for specialized agentic loops that benefit from persistent state, rich introspection, and iterative reasoning over page structure, such as exploratory automation, self-healing tests, or long-running autonomous workflows where maintaining continuous browser context outweighs token cost concerns. Learn more about [Playwright MCP](https://github.com/microsoft/playwright-mcp).
### Key Features
- **Token-efficient**. Does not force page data into LLM.
### Requirements
- Node.js 18 or newer
- Claude Code, GitHub Copilot, or any other coding agent.
## Getting Started
## Installation
```bash
npm install -g @playwright/cli@latest
playwright-cli --help
```
Argument parsing and startup errors exit with code 1 and print an error message. With
`--json`, these errors are written to stdout as `{ "isError": true, "error": "..." }`.
### Installing skills
Claude Code, GitHub Copilot and others will use the locally installed skills.
```bash
playwright-cli install --skills
```
### Skills-less operation
Point your agent at the CLI and let it cook. It'll read the skill off `playwright-cli --help` on its own:
```
Test the "add todo" flow on https://demo.playwright.dev/todomvc using playwright-cli.
Check playwright-cli --help for available commands.
```
## Demo
```
> Use playwright skills to test https://demo.playwright.dev/todomvc/.
Take screenshots for all successful and failing scenarios.
```
Your agent will be running commands, but it does not mean you can't play with it manually:
```
playwright-cli open https://demo.playwright.dev/todomvc/ --headed
playwright-cli type "Buy groceries"
playwright-cli press Enter
playwright-cli type "Water flowers"
playwright-cli press Enter
playwright-cli check e21
playwright-cli check e35
playwright-cli screenshot
```
## Headed operation
Playwright CLI is headless by default. If you'd like to see the browser, pass `--headed` to `open`:
```bash
playwright-cli open https://playwright.dev --headed
```
## Sessions
Playwright CLI keeps the browser profile in memory by default. Your cookies and storage state
are preserved between CLI calls within the session, but lost when the browser closes. Use
`--persistent` to save the profile to disk for persistence across browser restarts.
You can use different inst
阅读完整原文
商业机会分析 AI 生成
Agent 专属云端浏览器沙盒托管平台
| 产品构想 | 为本地运行的 Claude Code / Copilot 提供即开即用的远程无头浏览器基础设施,避免本地机器被多个 Chrome 会话耗尽 CPU/内存。 |
| 核心功能 | 远程 session 隧道代理(兼容 playwright-cli -s 命令)、实时 WebRTC 画面预览(对应 show 命令)、用完即毁沙盒环境、网络代理集成。 |
| 目标用户 | 频繁使用 CLI 编程代理进行高强度测试的开发者、笔记本硬件资源有限的远程工程师。 |
| 难度/周期 | 中等 · 4-6 周 · 成本:低(主要为云服务器与轻量容器调度开销) |
| 收费模式 | 按浏览器运行机时或活跃会话数订阅(Freemium + 阶梯定价)。 |
| 竞争风险 | 网络延迟可能导致 CLI 执行指令变慢;需防范滥用(如恶意爬虫或黑客扫描)。 |
| 依据 | 数据支持的判断 |
企业级 Agent 会话认证与状态同步工具(Auth Sync Bridge)
| 产品构想 | 解决 Agent 无法直接绕过企业 2FA/SSO 的痛点,提供浏览器插件一键将员工本地认证态安全注入 playwright-cli 的持久化会话(--persistent)。 |
| 核心功能 | 一键导出 Chrome/Firefox 凭据到 playwright-cli 会话文件、敏感 Cookie 脱敏、会话有效性定时探测与告警、多环境账号切换。 |
| 目标用户 | 在内网或受认证保护的预发布环境下使用 AI 代理写测试的企业研发人员。 |
| 难度/周期 | 低 · 2-3 周 · 成本:极低(主要是客户端插件与本地 CLI 脚本) |
| 收费模式 | 企业版单席位月付授权(针对团队级凭证安全分发与合规审计)。 |
| 竞争风险 | 安全合规风险(涉及企业 Cookie/Token 处理),推测企业 IT 部门可能对此类注入工具有严格准入审查。 |
| 依据 | 已验证事实 |
Agent E2E 测试成果沉淀与视觉回归审查看板
| 产品构想 | 基于 playwright-cli 的 --json 输出与 screenshot 能力,封装测试结果聚合服务,将 Agent 执行过程转化为可视化回归测试报告。 |
| 核心功能 | 自动捕获 CLI 执行步骤截图并生成时间轴、UI 视觉差对比、Agent 失败步骤重试分析、生成标准 Playwright 测试脚本沉淀至代码库。 |
| 目标用户 | 引入 AI 辅助测试的研发主管、质量保障(QA)团队。 |
| 难度/周期 | 中等 · 4-8 周 · 成本:低(静态存储 + 基础图像对比计算) |
| 收费模式 | SaaS 订阅制(按月度处理的测试快照量计费)。 |
| 竞争风险 | Playwright 官方生态自身已具备 trace viewer,需明确拉开差异化(专注于 AI Agent 交互过程与视觉比对)。 |
| 依据 | AI推测 |
AI 基于仓库公开数据分析生成,含推测成分,不构成收益承诺。
报告会保存到 个人中心
竞品与相似项目 GitHub Search 真实检索
| 项目 | 中文简介 | Stars | 语言 |
|---|---|---|---|
| browser-use/browser-use | 中文介绍暂未生成 Open-source Python library for AI browser agents, plus Brows |
120,726 | Python |
| D4Vinci/Scrapling | 中文介绍暂未生成 🕷️ The BEST Web Scraping framework that handles everything f |
101,576 | Python |
| microsoft/playwright | 中文介绍暂未生成 Playwright is a framework for Web Testing and Automation. It |
99,878 | TypeScript |
| unclecode/crawl4ai | 中文介绍暂未生成 Official Crawl4AI Cloud: a hosted web scraping, extraction, |
87,228 | Python |
| fastapi/full-stack-fastapi-template | 中文介绍暂未生成 Full-stack web application template with FastAPI, React, SQL |
46,233 | TypeScript |
| lightpanda-io/browser | 中文介绍暂未生成 Lightpanda: the headless browser designed for AI and automat |
41,899 | Zig |
以上为通过 GitHub 官方 Search API 检索的相似项目,功能差异与优劣势需进一步人工确认,配置 AI 后可生成对比分析。
项目优势与风险
| 技术成熟度 | 创建于 2020-06-19,近 30 天仍在推送,发布过 27 个 Release |
| 社区活跃 | Star 15,131 / Fork 914 / Issue 2(数据支持,可自行核实) |
| 许可证 | Apache-2.0 |
| 主要风险 | 上游项目方向可能变化;同赛道竞争者较多(见竞品表);热度与需求不完全等价 |
安装与使用
快速开始(以仓库 README 为准)
git clone https://github.com/microsoft/playwright-cli.git cd playwright-cli # 请阅读仓库 README 获取确切安装步骤(依赖、配置、启动命令)
术语说明:Docker=应用容器(把程序和依赖打包运行);API Key=调用外部服务的密钥;Git Clone=把仓库代码下载到本地。常见错误:API Key 未配置 / 端口占用 / 数据库连接失败,多数项目在 README 的 Troubleshooting 章节有说明。