skills/playwright/SKILL.md
Browser automation and web scraping with Playwright. Forms, screenshots, data extraction. Works standalone or via MCP. Testing included.
npx skillsauth add pr-e/openclaw-master-skills Playwright (Automation + MCP + Scraper)Install this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use this skill when you need to:
| Scenario | Method | Speed |
|----------|--------|-------|
| Static HTML | web_fetch tool | ⚡ Fastest |
| JavaScript-rendered | Playwright direct | 🚀 Fast |
| AI agent automation | MCP server | 🤖 Integrated |
| E2E testing | @playwright/test | ✅ Full framework |
| Task | File |
|------|------|
| E2E testing patterns | testing.md |
| CI/CD integration | ci-cd.md |
| Debugging failures | debugging.md |
| Web scraping patterns | scraping.md |
| Selector strategies | selectors.md |
waitForTimeout() - always wait for specific conditions (element, URL, network)browser.close() to prevent memory leaksgetByRole() survives UI changes better than CSSwaitFor() before interacting with elementsstorageState to save and reuse login sessionsconst { 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();
await page.goto('https://example.com/login');
await page.getByLabel('Email').fill('[email protected]');
await page.getByLabel('Password').fill('secret');
await page.getByRole('button', { name: 'Sign in' }).click();
await page.waitForURL('**/dashboard');
await page.goto('https://example.com');
await page.screenshot({ path: 'screenshot.png', fullPage: true });
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);
}
| Priority | Method | Example |
|----------|--------|---------|
| 1 | getByRole() | getByRole('button', { name: 'Submit' }) |
| 2 | getByLabel() | getByLabel('Email') |
| 3 | getByPlaceholder() | getByPlaceholder('Search...') |
| 4 | getByTestId() | getByTestId('submit-btn') |
| 5 | locator() | locator('.class') - last resort |
| Trap | Fix |
|------|-----|
| Element not found | Add await locator.waitFor() before interacting |
| Flaky clicks | Use click({ force: true }) or wait for state: 'visible' |
| Timeout in CI | Increase timeout, check viewport size matches local |
| Auth lost between tests | Use storageState to persist cookies |
| SPA never reaches networkidle | Wait for specific DOM element instead |
| 403 Forbidden | Check if site blocks headless; try headless: false |
| Blank page after load | Increase wait time or use waitUntil: 'networkidle' |
// Save session after login
await page.context().storageState({ path: 'auth.json' });
// Reuse session in new context
const context = await browser.newContext({ storageState: 'auth.json' });
For AI agents using Model Context Protocol:
npm install -g @playwright/mcp
npx @playwright/mcp --headless
| Tool | Description |
|------|-------------|
| browser_navigate | Navigate to URL |
| browser_click | Click element by selector |
| browser_type | Type text into input |
| browser_select_option | Select dropdown option |
| browser_get_text | Get text content |
| browser_evaluate | Execute JavaScript |
| browser_snapshot | Get accessible page snapshot |
| browser_close | Close browser context |
| browser_choose_file | Upload file |
| browser_press | Press keyboard key |
--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
npm init playwright@latest
# Or add to existing project
npm install -D @playwright/test
npx playwright install chromium
Install with clawhub install <slug> if user confirms:
puppeteer - Alternative browser automation (Chrome-focused)scrape - General web scraping patterns and strategiesweb - Web development fundamentals and HTTP handlingclawhub star playwrightclawhub syncdevelopment
Fetch and read transcripts from YouTube videos. Use when you need to summarize a video, answer questions about its content, or extract information from it.
devops
Fetch and summarize YouTube video transcripts. Use when asked to summarize, transcribe, or extract content from YouTube videos. Handles transcript fetching via residential IP proxy to bypass YouTube's cloud IP blocks.
content-media
# youtube-auto-captions - YouTube 自动字幕 ## 描述 自动为 YouTube 视频生成字幕,支持多语言翻译、时间轴校准。提升视频可访问性和 SEO。 ## 定价 - **按次收费**: ¥9/次 - 每视频最长 60 分钟 - 支持 50+ 语言 ## 用法 ```bash # 生成字幕 /youtube-auto-captions --video <video_id> --lang zh # 翻译字幕 /youtube-auto-captions --video <video_id> --translate en,ja,ko # 批量处理 /youtube-auto-captions --playlist <playlist_id> --lang zh # 导出字幕 /youtube-auto-captions --video <video_id> --export srt ``` ## 技能目录 `~/.openclaw/workspace/skills/youtube-auto-captions/` ## 作者 张 sir #
development
YouTube Data API integration with managed OAuth. Search videos, manage playlists, access channel data, and interact with comments. Use this skill when users want to interact with YouTube. For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gateway).