技能版本 1.0.0
playwright-cli
Automates browser interactions for web testing, form filling, screenshots, and data extraction. Use when the user needs to navigate websites, interact with web pages, fill forms, take screenshots, test web applications, or extract information from web pages.
价格
免费
- 安装:免费
在组织开通时一次性收取;再次读取清单或下载不重复收费。
以上为公开标价。你的组织可能有协议价,以控制台显示的价格为准。
如何使用
为组织安装
开通即安装:组织固定使用开通时的版本(当前为 1.0.0)。升级到新版本需要取消后重新开通。
创建凭证
客户端使用组织凭证读取;绑定到数字人后,数字人使用绑定凭证按需加载。请求中携带:
Authorization: Bearer $ZGI_MARKET_KEY读取清单与安装包
清单列出版本、文件和校验值;安装包是一个 zip 文件。
读取清单 curl "https://market-api.zgi.im/v1/market/skills/playwright-cli/manifest" \ -H "Authorization: Bearer $ZGI_MARKET_KEY"下载安装包 curl "https://market-api.zgi.im/v1/market/skills/playwright-cli/package" \ -H "Authorization: Bearer $ZGI_MARKET_KEY" \ -o playwright-cli.zip读取清单和下载安装包不计入用量。下载后请用响应头中的 SHA-256 校验文件。
技能说明
- 名称
- playwright-cli
- 说明
- Automates browser interactions for web testing, form filling, screenshots, and data extraction. Use when the user needs to navigate websites, interact with web pages, fill forms, take screenshots, test web applications, or extract information from web pages.
仅指令
技能包内没有脚本文件:这个技能是供模型阅读的文本。
SKILL.md 节选
# Browser Automation with playwright-cli
## ⚠️ Critical: First-time Setup
If `playwright-cli` is not found in PATH, locate it dynamically:
```bash
# Find the actual path (works across macOS/Linux, Homebrew/nvm/fnm)
PCLI=$(command -v playwright-cli || npm bin -g 2>/dev/null | xargs -I{} echo {}/playwright-cli)
# If still not found, install:
npm install -g @playwright/cli@latest
```
> **Do NOT hardcode** paths like `/opt/homebrew/bin/playwright-cli`. Different systems have different npm global bin paths.
## ⚠️ Critical: Snapshot Output
By default, `snapshot` saves output to **files** in `.playwright-cli/` directory (not stdout).
**To read snapshot results, you MUST cat the output file:**
```bash
playwright-cli snapshot
# Then read the latest snapshot file:
cat .playwright-cli/page-*.yml | tail -200
# Or use a specific filename:
playwright-cli snapshot --filename=snap.yaml
cat .playwright-cli/snap.yaml
```
**Alternatively**, set output mode to stdout in a config file `playwright-cli.json`:
```json
{ "outputMode": "stdout" }
```
## Quick start
```bash
# open new browser
playwright-cli open
# navigate to a page
playwright-cli goto https://playwright.dev
# take snapshot to get element refs
playwright-cli snapshot
# read the snapshot output (saved to .playwright-cli/ directory)
cat .playwright-cli/page-*.yml
# interact with the page using refs from the snapshot
playwright-cli click e15
playwright-cli type "page.click"
playwright-cli press Enter
# take a screenshot
playwright-cli screenshot
# close the browser
playwright-cli close
```
## Commands
### Core
```bash
playwright-cli open
# open and navigate right away
playwright-cli open https://example.com/
playwright-cli goto https://playwright.dev
playwright-cli type "search query"
playwright-cli click e3
playwright-cli dblclick e7
playwright-cli fill e5 "user@example.com"
playwright-cli drag e2 e8
playwright-cli hover e4
playwright-cli select e9 "option-value"
playwright-cli upload ./document.pdf
playwright-cli check e12
playwright-cli uncheck e12
playwright-cli snapshot
playwright-cli snapshot --filename=after-click.yaml
playwright-cli eval "document.title"
playwright-cli eval "el => el.textContent" e5
playwright-cli dialog-accept
playwright-cli dialog-accept "confirmation text"
playwright-cli dialog-dismiss
playwright-cli resize 1920 1080
playwright-cli close
```
### Navigation
```bash
playwright-cli go-back
playwright-cli go-forward
playwright-cli reload
```
### Keyboard
```bash
playwright-cli press Enter
playwright-cli press ArrowDown
playwright-cli keydown Shift
playwright-cli keyup Shift
```
### Mouse
```bash
playwright-cli mousemove 150 300
playwright-cli mousedown
playwright-cli mousedown right
playwright-cli mouseup
playwright-cli mouseup right
playwright-cli mousewheel 0 100
```
### Save as
```bash
playwright-cli screenshot
playwright-cli screenshot e5
playwright-cli screenshot --filename=page.png
playwright-cli pdf --filename=page.pdf
```
### Tabs
```bash
playwright-cli tab-list
playwright-cli tab-new
playwright-cli tab-new https://example.com/page
playwright-cli tab-close
playwright-cli tab-close 2
playwright-cli tab-select 0
```
### Storage
```bash
playwright-cli state-save
playwright-cli state-save auth.json
playwright-cli state-load auth.json
# Cookies
playwright-cli cookie-list
playwright-cli cookie-list --domain=example.com
playwright-cli cookie-get session_id
playwright-cli cookie-set session_id abc123
playwright-cli cookie-set session_id abc123 --domain=example.com --httpOnly --secure
playwright-cli cookie-delete session_id
playwright-cli cookie-clear
# LocalStorage
playwright-cli localstorage-list
playwright-cli localstorage-get theme
playwright-cli localstorage-set theme dark
playwright-cli localstorage-delete theme
playwright-cli localstorage-clear
# SessionStorage
playwright-cli sessionstorage-list
playwright-cli sessionstorage-get step
playwright-cli sessionstorage-set step 3
playwright-cli sessionstorage-delete step
playwright-cli sessionstorage-clear
```
### Network
```bashSKILL.md 不止这些内容,安装后可阅读全文。
技能包内容
共 8 个文件,合计 30.8 KiB
- SKILL.md7.8 KiB
- references/request-mocking.md2.1 KiB
- references/running-code.md5.1 KiB
- references/session-management.md3.9 KiB
- references/storage-state.md5.1 KiB
- references/test-generation.md2.4 KiB
- references/tracing.md3.4 KiB
- references/video-recording.md1.0 KiB
来源与审核
- 审核状态
- 尚未审核,内容来自上游来源
- 许可证
- 未说明
审核状态是平台对上架信息的记录,不构成对上游服务质量或可用性的担保。