Back to Registry
View Author Profile
Official Verified
playwright-npx
Fast browser automation using Node.js scripts with Playwright (run via `node script.mjs`). Use for web scraping, screenshots, form automation, and any browser task requiring programmatic control. For simple page fetching without JavaScript execution, use web_fetch first. For interactive CLI browsing without writing code, use browser tool or playwright-cli. This skill is ideal when you need full control, custom logic, or reusable scripts.
skill-install — Terminal
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/mahone-bot/playwright-npxOr
Playwright Browser Automation
🤝 Developed together by Kuba + Mahone · Feb 2026
Code-first browser automation with Playwright.
When to Use
| Tool | Use When |
|---|---|
| web_fetch | Simple pages, no JavaScript needed |
| This skill | JavaScript-heavy sites, complex interactions, full control |
| stealth-browser | Bot detection / Cloudflare issues |
| browser tool | Visual exploration, last resort |
| playwright-cli | Interactive CLI without writing code |
Setup
# One-time per project
npm init -y
npm install playwright
npx playwright install chromium
package.json example:
{
"name": "my-automation",
"type": "module",
"dependencies": {
"playwright": "^1.40.0"
}
}
Minimal Example
// tmp/example.mjs
import { chromium } from 'playwright';
const browser = await chromium.launch();
const page = await browser.newPage();
await page.goto('https://example.com');
console.log('Title:', await page.title());
await browser.close();
node tmp/example.mjs
Quick Patterns
Screenshot
import { chromium } from 'playwright';
const browser = await chromium.launch();
const page = await browser.newPage();
await page.setViewportSize({ width: 1280, height: 800 });
await page.goto('https://example.com');
await page.screenshot({ path: 'tmp/screenshot.png', fullPage: true });
await browser.close();
Scrape Data
import { chromium } from 'playwright';
const browser = await chromium.launch();
const page = await browser.newPage();
await page.goto('https://news.ycombinator.com');
const stories = await page.$$eval('.titleline > a', links =>
links.slice(0, 5).map(a => ({ title: a.innerText, url: a.href }))
);
console.log(JSON.stringify(stories, null, 2));
await browser.close();
Form Interaction
await page.goto('https://example.com/login');
await page.fill('input[name="email"]', '[email protected]');
await page.fill('input[name="password"]', 'password');
await page.click('button[type="submit"]');
Wait for Dynamic Content
// Wait for network idle (SPA)
await page.goto(url, { waitUntil: 'networkidle' });
// Wait for specific element
await page.waitForSelector('.results', { timeout: 10000 });
// Wait for condition
await page.waitForFunction(() =>
document.querySelectorAll('.item').length > 0
);
Persistent Session
import fs from 'fs';
const SESSION_FILE = 'tmp/session.json';
let context;
if (fs.existsSync(SESSION_FILE)) {
context = await browser.newContext({ storageState: SESSION_FILE });
} else {
context = await browser.newContext();
}
const page = await context.newPage();
// ... login ...
await context.storageState({ path: SESSION_FILE });
Headless vs Headed
// Headless (default, fastest)
await chromium.launch({ headless: true });
// Headed (see the browser)
await chromium.launch({ headless: false });
Metadata
AI Skill Finder
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skill Add to Configuration
Paste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-mahone-bot-playwright-npx": {
"enabled": true,
"auto_update": true
}
}
}Safety NoteClawKit audits metadata but not runtime behavior. Use with caution.