pr-e/openclaw-master-skills/playwright

Claude Code and agent skill by pr-e/openclaw-master-skills

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Browser automation and web scraping with Playwright. Forms, screenshots, data extraction. Works standalone or via MCP. Testing included.

Install

npx vskill@latest install pr-e/openclaw-master-skills/playwright

SKILL.md

When to Use

Use this skill when you need to:

  • Scrape a website (static or JavaScript-rendered)
  • Automate form filling (login, checkout, data entry)
  • Test a web application (E2E tests, visual regression)
  • Take screenshots or PDFs of web pages
  • Extract data from tables, lists, or dynamic content

Decision Matrix

ScenarioMethodSpeed
Static HTMLweb_fetch tool⚡ Fastest
JavaScript-renderedPlaywright direct🚀 Fast
AI agent automationMCP server🤖 Integrated
E2E testing@playwright/test✅ Full framework

Quick Reference

TaskFile
E2E testing patternstesting.md
CI/CD integrationci-cd.md
Debugging failuresdebugging.md
Web scraping patternsscraping.md
Selector strategiesselectors.md

Core Rules

  1. Never use `waitForTimeout()` - always wait for specific conditions (element, URL, network)
  2. Always close the browser - call browser.close() to prevent memory leaks
  3. Prefer role selectors - getByRole() survives UI changes better than CSS
  4. Handle dynamic content - use waitFor() before interacting with elements
  5. Persist auth state - use storageState to save and reuse login sessions

Quick Start - Common Tasks

Scrape a Page
javascript
const { chromium } = require('playwright');
const browser = await chromium.launch();
const page = await browser.newPage();
await page.goto('https://example.com');
const text = await page.locator('body').textContent();
await browser.close();
Fill a Form and Submit
javascript
await page.goto('https://example.com/login');
await page.getByLabel('Email').fill('user@example.com');
await page.getByLabel('Password').fill('secret');
await page.getByRole('button', { name: 'Sign in' }).click();
await page.waitForURL('**/dashboard');
Take a Screenshot
javascript
await page.goto('https://example.com');
await page.screenshot({ path: 'screenshot.png', fullPage: true });
Extract Table Data
javascript
const rows = await page.locator('table tr').all();
const data = [];
for (const row of rows) {
const cells = await row.locator('td').allTextContents();
data.push(cells);
}

Selector Priority

PriorityMethodExample
1getByRole()getByRole('button', { name: 'Submit' })
2getByLabel()getByLabel('Email')
3getByPlaceholder()getByPlaceholder('Search...')
4getByTestId()getByTestId('submit-btn')
5locator()locator('.class') - last resort

Common Traps

TrapFix
Element not foundAdd await locator.waitFor() before interacting
Flaky clicksUse click({ force: true }) or wait for state: 'visible'
Timeout in CIIncrease timeout, check viewport size matches local
Auth lost between testsUse storageState to persist cookies
SPA never reaches networkidleWait for specific DOM element instead
403 ForbiddenCheck if site blocks headless; try headless: false
Blank page after loadIncrease wait time or use waitUntil: 'networkidle'

Handling Sessions

javascript
// Save session after login
await page.context().storageState({ path: 'auth.json' });
// Reuse session in new context
const context = await browser.newContext({ storageState: 'auth.json' });

MCP Integration

For AI agents using Model Context Protocol:

bash
npm install -g @playwright/mcp
npx @playwright/mcp --headless
MCP Tools Reference
ToolDescription
browser_navigateNavigate to URL
browser_clickClick element by selector
browser_typeType text into input
browser_select_optionSelect dropdown option
browser_get_textGet text content
browser_evaluateExecute JavaScript
browser_snapshotGet accessible page snapshot
browser_closeClose browser context
browser_choose_fileUpload file
browser_pressPress keyboard key
MCP Server Options
bash
--headless # Run without UI
--browser chromium # chromium|firefox|webkit
--viewport-size 1920x1080
--timeout-action 10000 # Action timeout (ms)
--timeout-navigation 30000
--allowed-hosts example.com,api.example.com
--save-trace # Save trace for debugging
--save-video 1280x720 # Record video

Installation

bash
npm init playwright@latest
# Or add to existing project
npm install -D @playwright/test
npx playwright install chromium

Related Skills

Install with clawhub install <slug> if user confirms:

  • puppeteer - Alternative browser automation (Chrome-focused)
  • scrape - General web scraping patterns and strategies
  • web - Web development fundamentals and HTTP handling

Feedback

  • If useful: clawhub star playwright
  • Stay updated: clawhub sync

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
3
7-day trend score
7

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/pr-e/openclaw-master-skills/playwright/badge)](https://verified-skill.com/skills/pr-e/openclaw-master-skills/playwright)

Something wrong with this skill or its page? Tell us.