Openclaw-master-skills Playwright (Automation + MCP + Scraper)
Browser automation and web scraping with Playwright. Forms, screenshots, data extraction. Works standalone or via MCP. Testing included.
install
source · Clone the upstream repo
git clone https://github.com/LeoYeAI/openclaw-master-skills
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/LeoYeAI/openclaw-master-skills "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/playwright" ~/.claude/skills/leoyeai-openclaw-master-skills-playwright-automation-mcp-scraper && rm -rf "$T"
OpenClaw · Install into ~/.openclaw/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/LeoYeAI/openclaw-master-skills "$T" && mkdir -p ~/.openclaw/skills && cp -r "$T/skills/playwright" ~/.openclaw/skills/leoyeai-openclaw-master-skills-playwright-automation-mcp-scraper && rm -rf "$T"
manifest:
skills/playwright/SKILL.mdsafety · automated scan (low risk)
This is a pattern-based risk scan, not a security review. Our crawler flagged:
- global npm install
Always read a skill's source content before installing. Patterns alone don't mean the skill is malicious — but they warrant attention.
source content
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
| Scenario | Method | Speed |
|---|---|---|
| Static HTML | tool | ⚡ Fastest |
| JavaScript-rendered | Playwright direct | 🚀 Fast |
| AI agent automation | MCP server | 🤖 Integrated |
| E2E testing | @playwright/test | ✅ Full framework |
Quick Reference
| Task | File |
|---|---|
| E2E testing patterns | |
| CI/CD integration | |
| Debugging failures | |
| Web scraping patterns | |
| Selector strategies | |
Core Rules
- Never use
- always wait for specific conditions (element, URL, network)waitForTimeout() - Always close the browser - call
to prevent memory leaksbrowser.close() - Prefer role selectors -
survives UI changes better than CSSgetByRole() - Handle dynamic content - use
before interacting with elementswaitFor() - Persist auth state - use
to save and reuse login sessionsstorageState
Quick Start - Common Tasks
Scrape a Page
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
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
await page.goto('https://example.com'); await page.screenshot({ path: 'screenshot.png', fullPage: true });
Extract Table Data
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
| Priority | Method | Example |
|---|---|---|
| 1 | | |
| 2 | | |
| 3 | | |
| 4 | | |
| 5 | | - last resort |
Common Traps
| Trap | Fix |
|---|---|
| Element not found | Add before interacting |
| Flaky clicks | Use or wait for |
| Timeout in CI | Increase timeout, check viewport size matches local |
| Auth lost between tests | Use to persist cookies |
| SPA never reaches networkidle | Wait for specific DOM element instead |
| 403 Forbidden | Check if site blocks headless; try |
| Blank page after load | Increase wait time or use |
Handling Sessions
// 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:
npm install -g @playwright/mcp npx @playwright/mcp --headless
MCP Tools Reference
| Tool | Description |
|---|---|
| Navigate to URL |
| Click element by selector |
| Type text into input |
| Select dropdown option |
| Get text content |
| Execute JavaScript |
| Get accessible page snapshot |
| Close browser context |
| Upload file |
| Press keyboard key |
MCP Server Options
--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
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:
- Alternative browser automation (Chrome-focused)puppeteer
- General web scraping patterns and strategiesscrape
- Web development fundamentals and HTTP handlingweb
Feedback
- If useful:
clawhub star playwright - Stay updated:
clawhub sync