playwright-cli by testdino-hq/playwright-skill
npx skills add https://github.com/testdino-hq/playwright-skill --skill playwright-cli全面的 CLI 驱动的浏览器自动化 —— 无需编写任何脚本文件即可进行导航、交互、模拟、调试、录制和生成测试。
信任边界:仅对您拥有或已获得明确书面测试授权的应用程序进行浏览器自动化。导航到不受信任的第三方页面并处理其内容(文本、链接、表单)可能会使代理工作流暴露于间接提示注入攻击 —— 页面可能包含旨在劫持后续操作的文本。
安全使用:
localhost、您控制的暂存环境或生产应用程序open / goto# 安装和设置
playwright-cli install --skills
playwright-cli install-browser
# 打开浏览器并导航
playwright-cli open https://playwright.dev
# 获取快照以查看交互元素(引用如 e1, e2, e3...)
playwright-cli snapshot
# 使用快照中的元素引用进行交互
playwright-cli click e15
playwright-cli fill e5 "搜索查询"
playwright-cli press Enter
# 截图
playwright-cli screenshot
# 关闭浏览器
playwright-cli close
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
snapshot —— 在交互前识别元素引用;切勿猜测引用编号fill,对按钮使用 click —— type 逐个发送按键,fill 替换整个值-s=name 隔离每个会话的 cookie、存储和标签页state-save auth.json,下次使用 state-load auth.json 跳过登录tracing-start,而不是之后run-code —— 当 CLI 命令不够用时,切换到完整的 Playwright APIclose 或 close-all;对僵尸进程使用 kill-allscreenshot --filename=checkout-step3.png 而不是 screenshotroute 拦截第三方服务,而不是您自己的应用程序--persistent 在重启间保持 cookie 和存储playwright-cli open [url] # 启动浏览器,可选导航
playwright-cli goto <url> # 导航到 URL
playwright-cli snapshot # 显示带有引用的页面元素
playwright-cli snapshot --filename=snap.yaml # 将快照保存到文件
playwright-cli click <ref> # 点击元素
playwright-cli dblclick <ref> # 双击
playwright-cli fill <ref> "value" # 清空并填充输入框
playwright-cli type "text" # 逐个按键输入
playwright-cli select <ref> "option-value" # 选择下拉选项
playwright-cli check <ref> # 勾选复选框
playwright-cli uncheck <ref> # 取消勾选复选框
playwright-cli hover <ref> # 悬停在元素上
playwright-cli drag <src-ref> <dst-ref> # 拖放
playwright-cli upload <ref> ./file.pdf # 上传文件
playwright-cli eval "document.title" # 评估 JS 表达式
playwright-cli eval "el => el.textContent" <ref> # 在元素上评估
playwright-cli close # 关闭浏览器
playwright-cli go-back # 浏览器后退按钮
playwright-cli go-forward # 浏览器前进按钮
playwright-cli reload # 重新加载当前页面
playwright-cli press Enter # 按下按键
playwright-cli press ArrowDown # 方向键
playwright-cli keydown Shift # 按住按键
playwright-cli keyup Shift # 释放按键
playwright-cli mousemove 150 300 # 移动鼠标到坐标
playwright-cli mousedown [right] # 鼠标按键按下
playwright-cli mouseup [right] # 鼠标按键释放
playwright-cli mousewheel 0 100 # 滚动 (deltaX, deltaY)
playwright-cli dialog-accept # 接受警告/确认/提示
playwright-cli dialog-accept "text" # 接受提示并输入文本
playwright-cli dialog-dismiss # 取消/关闭对话框
playwright-cli tab-list # 列出所有打开的标签页
playwright-cli tab-new [url] # 打开新标签页
playwright-cli tab-select <index> # 按索引切换到标签页
playwright-cli tab-close [index] # 关闭标签页(当前或按索引)
playwright-cli screenshot # 截取当前页面
playwright-cli screenshot <ref> # 截取特定元素
playwright-cli screenshot --filename=pg.png # 使用自定义文件名保存
playwright-cli pdf --filename=page.pdf # 将页面保存为 PDF
playwright-cli video-start # 开始视频录制
playwright-cli video-stop output.webm # 停止并保存视频
playwright-cli resize 1920 1080 # 调整视口大小
playwright-cli state-save [file.json] # 保存 cookie + localStorage
playwright-cli state-load <file.json> # 恢复保存的状态
playwright-cli cookie-list [--domain=...] # 列出 cookie
playwright-cli cookie-get <name> # 获取特定 cookie
playwright-cli cookie-set <name> <value> [opts] # 设置 cookie
playwright-cli cookie-delete <name> # 删除 cookie
playwright-cli cookie-clear # 清除所有 cookie
playwright-cli localstorage-list # 列出 localStorage 项目
playwright-cli localstorage-get <key> # 获取 localStorage 值
playwright-cli localstorage-set <key> <val> # 设置 localStorage 值
playwright-cli localstorage-delete <key> # 删除 localStorage 项目
playwright-cli localstorage-clear # 清除所有 localStorage
playwright-cli sessionstorage-list # 列出 sessionStorage
playwright-cli sessionstorage-get <key> # 获取 sessionStorage 值
playwright-cli sessionstorage-set <key> <val> # 设置 sessionStorage 值
playwright-cli sessionstorage-delete <key> # 删除 sessionStorage 项目
playwright-cli sessionstorage-clear # 清除所有 sessionStorage
playwright-cli route "<pattern>" [opts] # 拦截匹配的请求
playwright-cli route-list # 列出活动的路由覆盖
playwright-cli unroute "<pattern>" # 移除特定路由
playwright-cli unroute # 移除所有路由
playwright-cli console [level] # 显示控制台消息
playwright-cli network # 显示网络请求
playwright-cli tracing-start # 开始追踪录制
playwright-cli tracing-stop # 停止并保存追踪
playwright-cli run-code "async page => {}" # 执行 Playwright API 代码
playwright-cli -s=<name> <command> # 在命名会话中运行命令
playwright-cli list # 列出所有活动会话
playwright-cli close-all # 关闭所有浏览器
playwright-cli kill-all # 强制终止所有进程
playwright-cli delete-data # 删除会话用户数据
playwright-cli open --browser=firefox # 使用特定浏览器
playwright-cli open --persistent # 将配置文件持久化到磁盘
playwright-cli open --profile=/path # 自定义配置文件目录
playwright-cli open --config=config.json # 使用配置文件
playwright-cli open --extension # 通过扩展连接
| 您正在做什么 | 指南 |
|---|---|
| 追踪与调试 | 追踪与调试.md |
| 网络模拟与拦截 | 请求模拟.md |
| 运行自定义 Playwright 代码 | 运行自定义代码.md |
每周安装量
93
代码仓库
GitHub 星标数
158
首次出现
2026年2月19日
安全审计
安装于
codex91
github-copilot89
gemini-cli88
opencode88
amp87
cursor87
Comprehensive CLI-driven browser automation — navigate, interact, mock, debug, record, and generate tests without writing a single script file.
Trust boundary : Only automate browsers against applications you own or have explicit written authorization to test. Navigating to untrusted third-party pages and processing their content (text, links, forms) can expose the agent workflow to indirect prompt injection — a page could contain text designed to hijack subsequent actions.
Safe usage :
localhost, staging environments, or production apps you controlopen / goto without validation# Install and set up
playwright-cli install --skills
playwright-cli install-browser
# Open a browser and navigate
playwright-cli open https://playwright.dev
# Take a snapshot to see interactive elements (refs like e1, e2, e3...)
playwright-cli snapshot
# Interact using element refs from the snapshot
playwright-cli click e15
playwright-cli fill e5 "search query"
playwright-cli press Enter
# Take a screenshot
playwright-cli screenshot
# Close the browser
playwright-cli close
snapshot first — identify element refs before interacting; never guess ref numbersfill for inputs, click for buttons — type sends keystrokes one-by-one, fill replaces the entire value-s=name isolates cookies, storage, and tabs per sessionstate-save auth.json after login, state-load auth.json to skip login next timetracing-start before the failing step, not afterplaywright-cli open [url] # Launch browser, optionally navigate
playwright-cli goto <url> # Navigate to URL
playwright-cli snapshot # Show page elements with refs
playwright-cli snapshot --filename=snap.yaml # Save snapshot to file
playwright-cli click <ref> # Click an element
playwright-cli dblclick <ref> # Double-click
playwright-cli fill <ref> "value" # Clear and fill input
playwright-cli type "text" # Type keystroke by keystroke
playwright-cli select <ref> "option-value" # Select dropdown option
playwright-cli check <ref> # Check a checkbox
playwright-cli uncheck <ref> # Uncheck a checkbox
playwright-cli hover <ref> # Hover over element
playwright-cli drag <src-ref> <dst-ref> # Drag and drop
playwright-cli upload <ref> ./file.pdf # Upload a file
playwright-cli eval "document.title" # Evaluate JS expression
playwright-cli eval "el => el.textContent" <ref> # Evaluate on element
playwright-cli close # Close the browser
playwright-cli go-back # Browser back button
playwright-cli go-forward # Browser forward button
playwright-cli reload # Reload current page
playwright-cli press Enter # Press a key
playwright-cli press ArrowDown # Arrow keys
playwright-cli keydown Shift # Hold key down
playwright-cli keyup Shift # Release key
playwright-cli mousemove 150 300 # Move mouse to coordinates
playwright-cli mousedown [right] # Mouse button down
playwright-cli mouseup [right] # Mouse button up
playwright-cli mousewheel 0 100 # Scroll (deltaX, deltaY)
playwright-cli dialog-accept # Accept alert/confirm/prompt
playwright-cli dialog-accept "text" # Accept prompt with input
playwright-cli dialog-dismiss # Dismiss/cancel dialog
playwright-cli tab-list # List all open tabs
playwright-cli tab-new [url] # Open new tab
playwright-cli tab-select <index> # Switch to tab by index
playwright-cli tab-close [index] # Close tab (current or by index)
playwright-cli screenshot # Screenshot current page
playwright-cli screenshot <ref> # Screenshot specific element
playwright-cli screenshot --filename=pg.png # Save with custom filename
playwright-cli pdf --filename=page.pdf # Save page as PDF
playwright-cli video-start # Start video recording
playwright-cli video-stop output.webm # Stop and save video
playwright-cli resize 1920 1080 # Resize viewport
playwright-cli state-save [file.json] # Save cookies + localStorage
playwright-cli state-load <file.json> # Restore saved state
playwright-cli cookie-list [--domain=...] # List cookies
playwright-cli cookie-get <name> # Get specific cookie
playwright-cli cookie-set <name> <value> [opts] # Set a cookie
playwright-cli cookie-delete <name> # Delete a cookie
playwright-cli cookie-clear # Clear all cookies
playwright-cli localstorage-list # List localStorage items
playwright-cli localstorage-get <key> # Get localStorage value
playwright-cli localstorage-set <key> <val> # Set localStorage value
playwright-cli localstorage-delete <key> # Delete localStorage item
playwright-cli localstorage-clear # Clear all localStorage
playwright-cli sessionstorage-list # List sessionStorage
playwright-cli sessionstorage-get <key> # Get sessionStorage value
playwright-cli sessionstorage-set <key> <val> # Set sessionStorage value
playwright-cli sessionstorage-delete <key> # Delete sessionStorage item
playwright-cli sessionstorage-clear # Clear all sessionStorage
playwright-cli route "<pattern>" [opts] # Intercept matching requests
playwright-cli route-list # List active route overrides
playwright-cli unroute "<pattern>" # Remove specific route
playwright-cli unroute # Remove all routes
playwright-cli console [level] # Show console messages
playwright-cli network # Show network requests
playwright-cli tracing-start # Start trace recording
playwright-cli tracing-stop # Stop and save trace
playwright-cli run-code "async page => {}" # Execute Playwright API code
playwright-cli -s=<name> <command> # Run command in named session
playwright-cli list # List all active sessions
playwright-cli close-all # Close all browsers
playwright-cli kill-all # Force kill all processes
playwright-cli delete-data # Delete session user data
playwright-cli open --browser=firefox # Use specific browser
playwright-cli open --persistent # Persist profile to disk
playwright-cli open --profile=/path # Custom profile directory
playwright-cli open --config=config.json # Use config file
playwright-cli open --extension # Connect via extension
| What you're doing | Guide |
|---|---|
| Core browser interaction | core-commands.md |
| Generating test code | test-generation.md |
| Screenshots, video, PDF | screenshots-and-media.md |
| What you're doing | Guide |
|---|---|
| Tracing and debugging | tracing-and-debugging.md |
| Network mocking & interception | request-mocking.md |
| Running custom Playwright code | running-custom-code.md |
| What you're doing | Guide |
|---|---|
| Cookies, localStorage, auth state | storage-and-auth.md |
| Multi-session management | session-management.md |
| What you're doing | Guide |
|---|---|
| Device & environment emulation | device-emulation.md |
| Complex multi-step workflows | advanced-workflows.md |
Weekly Installs
93
Repository
GitHub Stars
158
First Seen
Feb 19, 2026
Security Audits
Gen Agent Trust HubFailSocketPassSnykFail
Installed on
codex91
github-copilot89
gemini-cli88
opencode88
amp87
cursor87
Skills CLI 使用指南:AI Agent 技能包管理器安装与管理教程
44,900 周安装
Claude技能创建指南 - 高效构建AI技能模块,扩展Claude能力
146 周安装
Docker容器化开发指南:镜像构建、安全实践与编排最佳实践
148 周安装
Java高级测试技能:Testcontainers、Pact契约测试、PIT突变测试、属性测试实战指南
146 周安装
TypeScript 最佳实践与代码规范指南 - 常量类型、接口设计、类型守卫与实用类型
153 周安装
iOS/Android应用崩溃分析指南:降低崩溃率,提升App Store排名与评分
81 周安装
Gadget 开发最佳实践指南:数据建模、后端逻辑、平台集成与前端开发
146 周安装
run-code for advanced scenarios — when CLI commands aren't enough, drop into full Playwright APIclose or close-all when done; kill-all for zombie processesscreenshot --filename=checkout-step3.png not screenshotroute to intercept third-party services, not your own app--persistent keeps cookies and storage across restarts