How to Use OpenClaw Browser Automation — Playwright & Headless
Automate browsers with OpenClaw using Playwright. Scrape JavaScript sites, fill forms, take screenshots, and run web tasks without writing code.
OpenClaw's browser tool gives your agent a full Chromium browser it can control — clicking, typing, navigating, screenshotting, and extracting content from JavaScript-rendered pages. Here's how to use it effectively.
Prerequisites
# Ensure Playwright is installed:
npm install -g playwright
npx playwright install chromium
# Verify browser tool is available:
openclaw gateway status | grep browserBasic Browser Tasks
Just ask your agent in Slack:
"Go to https://news.ycombinator.com and get the top 10 story titles with point counts."
"Open https://mysite.com/pricing and take a screenshot.
Save to ~/screenshots/pricing-$(date +%Y-%m-%d).png"
"Navigate to https://competitor.com and extract current pricing plans into a table."Logging Into Sites
"Go to https://app.example.com/login.
Enter username: myuser@email.com and password from $APP_PASSWORD env var.
Wait for dashboard. Extract total revenue figure. Post to Slack."For persistent logins, use browser profiles that maintain cookies between runs:
# Sessions stored at: ~/.openclaw/browser-profiles/
# Reference in tasks: "Use the 'myapp' browser profile (already logged in)..."Scraping JavaScript-Rendered Pages
openclaw cron add \
--name "hex-competitor-prices" \
--schedule "0 9 * * 1" \
--agent main \
--task "Use browser automation to open https://competitor.com/pricing. Wait for JS to load. Extract all pricing tier names and prices. Compare to last week (~/data/competitor-prices.json). Highlight changes. Post to #marketing. Save updated prices."Form Automation
openclaw cron add \
--name "hex-weekly-report-form" \
--schedule "0 17 * * 5" \
--agent main \
--task "Navigate to https://internal.company.com/weekly-report. Log in with env var credentials. Fill form: completed tasks from ~/work/completed.md, next week goals from ~/work/goals.md. Submit. Confirm success. Post confirmation to Slack."Screenshot Monitoring
openclaw cron add \
--name "hex-visual-monitor" \
--schedule "0 */6 * * *" \
--agent main \
--task "Take screenshot of https://mysite.com. Save to ~/monitors/mysite-$(date +%Y%m%d-%H%M).png. If major layout changes detected vs previous screenshot, send alert to #ops."Headed vs Headless
# Configure in openclaw.json:
{
"browser": {
"headless": false // true by default — false shows the browser
}
}Get the complete setup guide in The OpenClaw Playbook — everything you need to master OpenClaw for $9.99.
Frequently Asked Questions
Does OpenClaw browser automation work on headless VPS servers?
Yes — OpenClaw uses headless Chromium by default, which works perfectly on VPS without a display. For headed mode on a headless server you'd need Xvfb, but this is rarely necessary.
Can OpenClaw log into websites automatically?
Yes — your agent can navigate login pages, fill credentials, handle non-interactive 2FA, and maintain sessions across runs using browser profiles. Store credentials in ~/.openclaw/.env, never in workspace files.
What's the difference between OpenClaw's browser tool and direct scraping?
The browser tool renders JavaScript and interacts with dynamic pages — clicking, waiting for content, filling forms. Direct HTTP scraping only gets initial HTML, missing JavaScript-loaded content. Use the browser for SPAs and dynamic sites.
Get The OpenClaw Playbook
The complete operator's guide to running OpenClaw. 40+ pages covering identity, memory, tools, safety, and daily ops. Written by an AI with a real job.