Token导航 LogoToken导航

Agent Skill · 研究检索

playwright(Playwright 浏览器测试)

用于辅助测试设计、自动化测试、用例整理和回归验证。它适合让 Agent 编写单元测试、端到端测试、测试计划或根据失败日志定位问题。使用时需要确认项目测试框架、运行命令和夹具数据,避免为了通过测试而改坏真实逻辑;涉及浏览器或外部服务时,应区分本地模拟、测试环境和生产环境。

playwright 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为接触敏感数据;许可证信息还不明确,第三方扫描有未通过项,按安装量在研究检索类的 73,675 个 Skill 里排第 55,945。

总安装 466周安装 20GitHub Stars 13下载 163核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:playwright(Playwright 浏览器测试)
来源仓库:https://github.com/dashed/claude-marketplace
仓库路径:skills/playwright
安装命令:
npx skills add https://github.com/dashed/claude-marketplace --skill playwright
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/dashed/claude-marketplace --skill playwright

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

playwright 提供浏览器自动化能力,用于端到端测试、截图抓取和表单填充。基于 Python + uv 构建自包含脚本,无需全局安装 Playwright 二进制文件。首次使用需手动下载浏览器 binaries(约 200MB),建议由用户执行安装命令。

适用于 Web 应用测试和回归验证,需区分模拟环境和真实生产流量。playwright 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

来源仓库内路径:skills/playwright

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/dashed/claude-marketplace --skill playwright;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要接触敏感数据,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

playwright 怎么安装?

在终端执行 npx skills add https://github.com/dashed/claude-marketplace --skill playwright。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

playwright 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

playwright 需要什么权限?

权限级别是接触敏感数据。该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

playwright 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

playwright 用的人多吗?

公开数据是累计安装 466 次,近一周安装 20 次,下载 163 次,GitHub 13 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

playwright 安全吗?

第三方扫描有未通过项,风险较高。除非你确认过源码,否则不建议直接安装到常用环境。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。

先想清楚的地方

  • 需要接触敏感数据,装到常用环境前要先评估影响面。
  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方扫描存在提醒项或未通过项,需要人工逐条确认。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 环境里有大量密钥、凭证,不方便给第三方 Skill 读取的人。
  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
playwright

Playwright 浏览器测试 · 本页

46613接触敏感数据未明确未通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Playwright Browser Automation

Overview

Playwright enables browser automation for web testing, screenshots, form filling, and scraping. This skill uses Python with uv for self-contained scripts that require no global installation.

Prerequisites

  • Python 3.10+
  • uv package manager
  • Playwright browser binaries (one-time setup)

Setup (First Time Only)

Claude: Do not run browser installation commands directly. Suggest these commands to the user and let them run manually. This is a one-time setup that downloads ~200MB of browser binaries.

Suggest the user run:

# Install Chromium (recommended, ~200MB)
uv run --with playwright playwright install chromium

# Or install all browsers
uv run --with playwright playwright install

To verify installation:

uv run /path/to/plugins/playwright/scripts/check_setup.py

Quick Start

Take a screenshot of any URL:

uv run /path/to/plugins/playwright/scripts/screenshot.py https://example.com

Output: /tmp/screenshot-{timestamp}.png

Common Patterns

Take a Screenshot

# Default (visible browser)
uv run scripts/screenshot.py https://example.com

# Full page, headless
uv run scripts/screenshot.py https://example.com --full-page --headless

# Custom output path
uv run scripts/screenshot.py https://example.com -o /tmp/my-shot.png

Navigate and Extract Content

# Get page title and URL
uv run scripts/navigate.py https://example.com

# Extract all links as JSON
uv run scripts/navigate.py https://example.com --links

# Get page text content
uv run scripts/navigate.py https://example.com --text

Fill and Submit Forms

uv run scripts/fill_form.py https://example.com/login \
  --field "email=test@example.com" \
  --field "password=secret123" \
  --submit

Execute JavaScript

uv run scripts/evaluate.py https://example.com "document.title"
uv run scripts/evaluate.py https://example.com "document.querySelectorAll('a').length"

Writing Custom Scripts

Save this template to /tmp/my-automation.py:

#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.10"
# dependencies = ["playwright==1.56.0"]
# ///
"""Custom Playwright automation script."""

import os
import sys
from playwright.sync_api import sync_playwright

HEADLESS = os.getenv("HEADLESS", "0").lower() in ("1", "true", "yes")

def main():
    with sync_playwright() as p:
        browser = p.chromium.launch(headless=HEADLESS)
        page = browser.new_page()

        try:
            page.goto("https://example.com")
            print(f"Title: {page.title()}")

            # Use semantic locators (preferred)
            page.get_by_role("button", name="Submit").click()
            page.get_by_label("Email").fill("test@example.com")

            # Screenshot
            page.screenshot(path="/tmp/result.png")

        except Exception as e:
            page.screenshot(path="/tmp/error.png")
            print(f"Error: {e}", file=sys.stderr)
            return 1
        finally:
            browser.close()

    return 0

if __name__ == "__main__":
    sys.exit(main())

Run with:

uv run /tmp/my-automation.py

Modern Locator API

Prefer semantic locators over CSS selectors:

# PREFERRED: Semantic locators (accessible, stable)
page.get_by_role("button", name="Submit").click()
page.get_by_label("Email").fill("user@example.com")
page.get_by_placeholder("Search...").fill("query")
page.get_by_text("Welcome back").wait_for()
page.get_by_test_id("submit-btn").click()

# AVOID: Raw CSS selectors (fragile)
page.locator("button.btn-primary").click()  # Don't use

Combine locators:

# OR: Match either
page.get_by_role("button", name="New").or_(
    page.get_by_text("Create")
).click()

# Filter: Narrow down
page.locator("tr").filter(has_text="Active").first.click()

Quick Reference

OperationCode
Navigatepage.goto("https://url")
Clickpage.get_by_role("button", name="X").click()
Fill inputpage.get_by_label("Email").fill("value")
Get textpage.get_by_role("heading").text_content()
Screenshotpage.screenshot(path="/tmp/shot.png")
Waitpage.get_by_text("Loaded").wait_for()
Evaluate JSpage.evaluate("document.title")

Environment Variables

VariableDescriptionDefault
HEADLESSRun browser headless0 (headed)
SLOW_MOSlow down actions (ms)0
VIEWPORTBrowser viewport1280x720
TRACEEnable tracing0 (off)

Example:

HEADLESS=1 SLOW_MO=250 uv run scripts/screenshot.py https://example.com

Tracing for Debugging

Enable tracing to debug complex automations:

context.tracing.start(screenshots=True, snapshots=True, sources=True)
# ... your automation ...
context.tracing.stop(path="/tmp/trace.zip")

View the trace:

uv run --with playwright playwright show-trace /tmp/trace.zip

Troubleshooting

"Browser not found"

Suggest the user install browser binaries (do not run directly):

uv run --with playwright playwright install chromium

"Timeout waiting for element"

Use proper waiting strategies:

# Wait for element to be visible
page.get_by_text("Loaded").wait_for(state="visible")

# Wait for network idle
page.goto(url, wait_until="networkidle")

"Element not interactable"

Ensure element is visible and scroll into view:

element = page.get_by_role("button", name="Submit")
element.scroll_into_view_if_needed()
element.click()

Headless mode issues

Debug with headed mode:

HEADLESS=0 uv run scripts/screenshot.py https://example.com

Container/CI Issues

Use these Chromium flags:

browser = p.chromium.launch(
    headless=True,
    args=["--disable-dev-shm-usage", "--no-sandbox"]
)

Advanced Usage

For comprehensive documentation, see:

平台分布

Codex

36.21%
按下载量换算59

Claude

29.82%
按下载量换算49

Cursor

18.24%
按下载量换算30

Gemini CLI

10.32%
按下载量换算17

安全审计

Gen Agent Trust Hub

通过

Socket

可疑

Snyk

未通过

权限和风险

接触敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在提醒或未通过项,安装前请自行复核。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills