Playwright (Automation + MCP + Scraper)
Automates, tests, and debugs browsers with Playwright: locators, auto-waiting, traces, CI runs, and MCP browser control. Use when a test is flaky, times out…
от clawic★ 23 звезды на GitHub
Установить Playwright (Automation + MCP + Scraper) в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
User preferences and memory live in ~/Clawic/data/playwright/ (see setup.md on first use). If you have data at an old location (~/playwright/ or ~/clawic/playwright/), move it to ~/Clawic/data/playwright/, and say in one line that you moved it and from where. Everything a run produces — specs, traces, reports, snapshots, storageState files — stays inside the repository or its temp dir, never in the preferences folder: auth state is a credential and belongs in a gitignored path.
When To Use
- Writing or repairing Playwright specs, fixtures,
playwright.config.ts, or one-off automation scripts - A run fails: timeout, strict mode violation, flaky click, passes locally and fails in CI or headless
- Login, session reuse, uploads, downloads, iframes, popups, dialogs, or device emulation are in the way
- Visual snapshots, accessibility checks, trace capture, sharding, or cutting suite wall time
- Driving a live browser through Playwright MCP, or extracting data a plain fetch cannot render
- Porting a Cypress, Puppeteer, or Selenium suite to Playwright, including deciding which tests not to port
- Not for maintaining an existing Cypress or Puppeteer suite (→
cypress,puppeteer) or for anything an HTTP request already answers (→http)
Quick Reference
| Situation | Play |
|---|---|
strict mode violation: resolved to N elements |
Narrow with .filter({ hasText }) or a parent chain — never .nth() unless position is the behavior under test → selectors.md |
Timeout 30000ms exceeded waiting for locator |
The locator never matched. Trace it, do not raise the timeout → debugging.md |
element is not visible / intercepts pointer events |
An overlay, animation, or disabled state — force: true hides the bug → waiting.md |
Test needs a waitForTimeout to pass |
Replace with a web-first assertion on the state you were sleeping for → waiting.md |
| Green locally, red in CI (or only headless) | Compare viewport, workers, timezone, animations, and browser build → flake.md, ci-cd.md |
| Passes alone, fails in the suite | Shared account, shared server data, or leaked storage — isolate per worker → auth.md |
| Same test red 1 run in 20 | Measure before fixing: --repeat-each, then classify by cause → flake.md |
| Login repeated in every test | Sign in once in a setup project, reuse storageState → auth.md |
| A test passes while the feature is broken, or nobody knows what deserves an E2E | What earns a test, outcome assertions, skip and fixme annotations → testing.md |
Writing playwright.config.ts, adding a project, a setting that will not apply |
Config anatomy, precedence, projects, webServer, tags → config.md |
| Setup repeated in every test, page objects, or where test data comes from | Test- and worker-scoped fixtures, page-object rules, data strategy → fixtures.md |
| Third party, payment sandbox, or slow API in the path | Intercept with page.route, or record and replay a HAR → network.md |
| Upload, download, PDF, or drag-and-drop | Event-first patterns (waitForEvent('download'), setInputFiles) → files.md |
New tab, popup, window.alert, geolocation, dark mode, offline |
Context-level control; dialogs auto-dismiss unless handled → contexts.md |
| Screenshot diff passes locally, fails on the runner | Snapshots are per-platform; generate them where CI runs → visual.md |
| WCAG or keyboard-navigation coverage | axe scan plus real keyboard assertions → accessibility.md |
| Suite takes too long | Measure the slowest tests first, then parallelize or seed via API → performance.md |
| Browser missing, wrong channel, WebKit-only failure | Version-locked browsers and engine differences → browsers.md |
| Agent should click through a live site now | Snapshot-driven MCP browser control → mcp.md |
| Pull data from a JS-rendered page | Bounded extraction with throttling → scraping.md |
| Porting from Cypress, Puppeteer, or Selenium | Translation table and the habits to drop → migration.md |
| Anything else | Reproduce headed with a trace (npx playwright test <file> --headed --trace on), open the trace, and read the DOM snapshot at the failing step |
CLI toolkit: commands.md. First-use preference loading: setup.md.
Core Rules
- Locate by what the user perceives. Order: role/label/text → test ID → CSS/XPath.
getByRole('button', { name: 'Submit' })survives a class rename and a CSS-in-JS rebuild;.css-1a2b3cdoes not. Test IDs are a contract you own — fine, but they assert nothing about accessibility. - Never sleep; assert.
page.waitForTimeout(500)is simultaneously too slow on a fast run and too short on a loaded runner. Web-first assertions re-check until the expect timeout (5 s default) and stop the moment the condition holds — strictly faster and strictly more reliable. - Budget the timeouts, do not inflate them. Defaults: test 30 000 ms, expect 5 000 ms, action and navigation 0 (unbounded, so the te
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- _meta.json
- accessibility.md
- auth.md
- browsers.md
- ci-cd.md
- commands.md
- config.md
- contexts.md
- debugging.md
- files.md
- fixtures.md
- flake.md
- mcp.md
- migration.md
- network.md
- performance.md
- scraping.md
- selectors.md
- setup.md
- testing.md
- visual.md
- waiting.md
FAQ
Что делает скилл Playwright (Automation + MCP + Scraper)?
Automates, tests, and debugs browsers with Playwright: locators, auto-waiting, traces, CI runs, and MCP browser control. Use when a test is flaky, times out, or fails only in CI or headless; when a locator matches multiple elements or the wrong one (strict mode violation); when clicks need force, waits become sleeps, or networkidle never settles; for storageState and login setup, request mocking and HAR replay, uploads and downloads, iframes and shadow DOM, popups and dialogs, screenshot diffs that change per machine, trace and report artifacts, sharding a slow suite, device and permission emulation, accessibility checks, driving a real browser through Playwright MCP, extracting data from JS-rendered pages, or porting a Cypress, Puppeteer, or Selenium suite to Playwright. Not for maintaining an existing Cypress or Puppeteer suite (cypress, puppeteer) or for work a plain HTTP request answers (http).
Как установить скилл Playwright (Automation + MCP + Scraper)?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл Playwright (Automation + MCP + Scraper) запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
docx
AnthropicUse this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include…
AnthropicUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple…
xlsx
AnthropicUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing…
pptx
AnthropicUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or…