Webapp Testing

bởi Anthropic

Bộ công cụ để tương tác và kiểm tra các ứng dụng web cục bộ bằng Playwright. Hỗ trợ xác minh chức năng giao diện người dùng, gỡ lỗi hành vi UI, chụp ảnh màn hình trình duyệt và xem nhật ký trình duyệt. giấy phép: Điều khoản đầy đủ trong LICENSE.txt

npx skills add https://github.com/anthropics/skills --skill webapp-testing

Web Application Testing

To test local web applications, write native Python Playwright scripts.

Helper Scripts Available:

  • scripts/with_server.py - Manages server lifecycle (supports multiple servers)

Always run scripts with --help first to see usage. DO NOT read the source until you try running the script first and find that a customized solution is abslutely necessary. These scripts can be very large and thus pollute your context window. They exist to be called directly as black-box scripts rather than ingested into your context window.

Decision Tree: Choosing Your Approach

User task → Is it static HTML?
    ├─ Yes → Read HTML file directly to identify selectors
    │         ├─ Success → Write Playwright script using selectors
    │         └─ Fails/Incomplete → Treat as dynamic (below)
    │
    └─ No (dynamic webapp) → Is the server already running?
        ├─ No → Run: python scripts/with_server.py --help
        │        Then use the helper + write simplified Playwright script
        │
        └─ Yes → Reconnaissance-then-action:
            1. Navigate and wait for networkidle
            2. Take screenshot or inspect DOM
            3. Identify selectors from rendered state
            4. Execute actions with discovered selectors

Example: Using with_server.py

To start a server, run --help first, then use the helper:

Single server:

python scripts/with_server.py --server "npm run dev" --port 5173 -- python your_automation.py

Multiple servers (e.g., backend + frontend):

python scripts/with_server.py \
  --server "cd backend && python server.py" --port 3000 \
  --server "cd frontend && npm run dev" --port 5173 \
  -- python your_automation.py

To create an automation script, include only Playwright logic (servers are managed automatically):

from playwright.sync_api import sync_playwright

with sync_playwright() as p:
    browser = p.chromium.launch(headless=True) # Always launch chromium in headless mode
    page = browser.new_page()
    page.goto('http://localhost:5173') # Server already running and ready
    page.wait_for_load_state('networkidle') # CRITICAL: Wait for JS to execute
    # ... your automation logic
    browser.close()

Reconnaissance-Then-Action Pattern

  1. Inspect rendered DOM:

    page.screenshot(path='/tmp/inspect.png', full_page=True)
    content = page.content()
    page.locator('button').all()
    
  2. Identify selectors from inspection results

  3. Execute actions using discovered selectors

Common Pitfall

Don't inspect the DOM before waiting for networkidle on dynamic apps ✅ Do wait for page.wait_for_load_state('networkidle') before inspection

Best Practices

  • Use bundled scripts as black boxes - To accomplish a task, consider whether one of the scripts available in scripts/ can help. These scripts handle common, complex workflows reliably without cluttering the context window. Use --help to see usage, then invoke directly.
  • Use sync_playwright() for synchronous scripts
  • Always close the browser when done
  • Use descriptive selectors: text=, role=, CSS selectors, or IDs
  • Add appropriate waits: page.wait_for_selector() or page.wait_for_timeout()

Reference Files

  • examples/ - Examples showing common patterns:
    • element_discovery.py - Discovering buttons, links, and inputs on a page
    • static_html_automation.py - Using file:// URLs for local HTML
    • console_logging.py - Capturing console logs during automation

Thêm skills từ Anthropic

Algorithmic Art
Anthropic
Tạo nghệ thuật thuật toán bằng p5.js với tính ngẫu nhiên có hạt giống và khám phá tham số tương tác. Sử dụng khi người dùng yêu cầu tạo nghệ thuật bằng mã, nghệ thuật sinh, nghệ thuật thuật toán, trường dòng chảy hoặc hệ thống hạt. Tạo nghệ thuật thuật toán gốc thay vì sao chép tác phẩm của nghệ sĩ hiện có để tránh vi phạm bản quyền. giấy phép: Điều khoản đầy đủ trong LICENSE.txt
creative
Internal Comms
Anthropic
Một bộ tài nguyên giúp tôi viết tất cả các loại truyền thông nội bộ, sử dụng các định dạng mà công ty tôi ưa thích. Claude nên sử dụng kỹ năng này bất cứ khi nào được yêu cầu viết một số loại truyền thông nội bộ (báo cáo trạng thái, cập nhật lãnh đạo, cập nhật 3P, bản tin công ty, Câu hỏi thường gặp, báo cáo sự cố, cập nhật dự án, v.v.). giấy phép: Điều khoản đầy đủ trong LICENSE.txt
Artifacts Builder
Anthropic
Bộ công cụ để tạo các tạo phẩm HTML claude.ai phức tạp, đa thành phần sử dụng công nghệ web frontend hiện đại (React, Tailwind CSS, shadcn/ui). Sử dụng cho các tạo phẩm phức tạp yêu cầu quản lý trạng thái, định tuyến hoặc các thành phần shadcn/ui - không dùng cho các tạo phẩm HTML/JSX đơn giản một tệp. giấy phép: Điều khoản đầy đủ trong LICENSE.txt
development
XLSX
Anthropic
Tạo, chỉnh sửa và phân tích bảng tính toàn diện với hỗ trợ công thức, định dạng, phân tích dữ liệu và trực quan hóa. Khi Claude cần làm việc với bảng tính (.xlsx, .xlsm, .csv, .tsv, v.v.) để: (1) Tạo bảng tính mới với công thức và định dạng, (2) Đọc hoặc phân tích dữ liệu, (3) Sửa đổi bảng tính hiện có trong khi giữ nguyên công thức, (4) Phân tích dữ liệu và trực quan hóa trong bảng tính, hoặc (5) Tính toán lại công thức giấy phép: Độc quyền. LICENSE.txt có các điều khoản đầy đủ
document
Skill Creator
Anthropic
Hướng dẫn tạo kỹ năng hiệu quả. Kỹ năng này nên được sử dụng khi người dùng muốn tạo một kỹ năng mới (hoặc cập nhật kỹ năng hiện có) nhằm mở rộng khả năng của Claude với kiến thức chuyên môn, quy trình làm việc hoặc tích hợp công cụ. giấy phép: Điều khoản đầy đủ trong LICENSE.txt
Slack Gif Creator
Anthropic
Bộ công cụ tạo ảnh động GIF được tối ưu cho Slack, kèm trình xác thực giới hạn kích thước và các thành phần hoạt ảnh có thể kết hợp. Kỹ năng này được áp dụng khi người dùng yêu cầu ảnh động GIF hoặc hoạt ảnh biểu tượng cảm xúc cho Slack qua các mô tả như "tạo cho tôi một GIF cho Slack về X đang làm Y". giấy phép: Điều khoản đầy đủ trong LICENSE.txt
creative
Theme Factory
Anthropic
Bộ công cụ để tạo kiểu cho các tạo phẩm với một chủ đề. Các tạo phẩm này có thể là slide, tài liệu, báo cáo, trang đích HTML, v.v. Có 10 chủ đề cài sẵn với màu sắc/phông chữ mà bạn có thể áp dụng cho bất kỳ tạo phẩm nào đã được tạo, hoặc có thể tạo chủ đề mới ngay lập tức. giấy phép: Điều khoản đầy đủ trong LICENSE.txt
creative
Brand Guidelines
Anthropic
Áp dụng màu sắc thương hiệu chính thức và kiểu chữ của Anthropic vào bất kỳ loại tạo phẩm nào có thể hưởng lợi từ việc có giao diện và cảm nhận của Anthropic. Sử dụng khi áp dụng màu sắc thương hiệu hoặc hướng dẫn phong cách, định dạng trực quan hoặc tiêu chuẩn thiết kế công ty. giấy phép: Điều khoản đầy đủ trong LICENSE.txt
creative