Skills & Plugins Dev & Automation Skills

OpenClaw Playwright Skill: Browser Automation for AI Agents

Use OpenClaw's Playwright skill to automate web scraping, form filling, screenshot capture, and browser workflows — with full headless browser control from your agent.

RN
R. Nakamura
Automation Engineer
2025-02-10 15 min 6.5k views
Updated Mar 2025
Key Takeaways
The Playwright skill is a ClaWHub plugin — install with 'openclaw skill install playwright' then run 'playwright install chromium'.
Supports Chromium, Firefox, and WebKit; Chromium recommended for production.
Automate form filling, clicks, navigation, screenshot capture, and full page scraping.
Enable session persistence with storage_state to reuse logins across agent runs.
Use stealth mode config to reduce detection on sites with basic bot protection.

Web scraping and browser automation transform OpenClaw from a text agent into one that can interact with any website — log in, extract data, fill forms, and take screenshots. The Playwright skill makes this possible without any custom code. Here's the full setup.

What Playwright Adds to OpenClaw

The Playwright skill gives OpenClaw full browser control. Instead of being limited to static HTML fetching, your agent can interact with JavaScript-rendered pages, authenticated dashboards, and dynamic web applications.

Core capabilities the skill unlocks:

  • Full-page scraping — extract content from JS-rendered sites that basic HTTP fetchers can't access
  • Form automation — fill and submit forms, including multi-step flows
  • Screenshot capture — visual documentation of web states for reporting or monitoring
  • Session persistence — maintain login state across multiple agent runs
💡
Use Playwright only when HTTP fetching fails
Browser automation is 10-50x slower than plain HTTP requests and uses more memory. Always try the web_fetch or web_search skill first. Use Playwright specifically for JS-rendered content, authentication flows, or click-through interactions.

Installation & Dependencies

Install the Playwright skill from ClaWHub and then install the browser binaries:

# Install the skill
openclaw skill install playwright

# Install browser binaries (chromium recommended)
playwright install chromium

# Verify installation
openclaw skill test playwright

The browser binary installation downloads approximately 150MB for Chromium. On constrained systems or containers, use the --with-deps flag to also install system dependencies: playwright install --with-deps chromium.

Container environments need extra deps
Docker and other container environments often lack the system libraries that Chromium needs. Run 'playwright install --with-deps chromium' in your container build step, not at runtime. Missing deps cause silent launch failures that are hard to debug.

Configuring the Skill

Add the Playwright skill to your OpenClaw skills config:

skills:
  playwright:
    enabled: true
    browser: chromium  # chromium | firefox | webkit
    headless: true
    timeout: 30000  # ms per action
    stealth: false  # set true for basic bot detection evasion
    storage_state: ""  # path to saved session file
    viewport:
      width: 1280
      height: 800
    screenshot_dir: "./screenshots"

Automatable Browser Actions

The Playwright skill exposes browser actions as OpenClaw skill calls. Chain them in sequence to build complete browser workflows:

skills:
  scrape_dashboard:
    trigger: event(manual)
    actions:
      - skill: playwright
        action: navigate
        url: "https://example.com/login"
      - skill: playwright
        action: fill
        selector: "#email"
        value: "{{secrets.SITE_EMAIL}}"
      - skill: playwright
        action: fill
        selector: "#password"
        value: "{{secrets.SITE_PASSWORD}}"
      - skill: playwright
        action: click
        selector: "button[type=submit]"
      - skill: playwright
        action: wait_for_selector
        selector: ".dashboard-content"
      - skill: playwright
        action: extract_text
        selector: ".metrics-panel"
      - skill: playwright
        action: screenshot
        path: "screenshots/dashboard-{{date}}.png"

The extract_text action returns the inner text of a matched element. For structured data, use extract_json with a selector pointing to a JSON script tag, or extract_table for HTML table data.

Common Mistakes

Not adding wait_for_selector steps after navigation is the most common cause of failed extractions. JavaScript-heavy pages need time to render before elements are queryable.

  • Using too broad selectors — generic selectors like div.content match dozens of elements. Use specific IDs or data attributes for reliable targeting.
  • Not saving session state — without storage_state, every run goes through the full login flow. Set up session persistence after the first successful login.
  • Timeout too low on slow sites — the default 30000ms timeout fails on heavy sites. Increase to 60000ms for pages that take longer to load.
  • Running headful in production — headful mode requires a display server. It works locally for debugging but fails in headless server environments without Xvfb.

Frequently Asked Questions

Does the Playwright skill come pre-installed with OpenClaw?
No. Playwright is a ClaWHub plugin. Install with 'openclaw skill install playwright' then install browser binaries with 'playwright install chromium'.

Which browsers does the OpenClaw Playwright skill support?
Chromium, Firefox, and WebKit are all supported. Chromium is the recommended choice — most stable with the smallest binary footprint.

Can OpenClaw use Playwright to take screenshots?
Yes. The screenshot action captures full-page or viewport screenshots and returns them as base64 or saves to a specified file path.

Is headless mode required for the Playwright skill?
Headless mode is the default and recommended for production. Set headless: false in the skill config for debugging — but this requires a display server.

Can the Playwright skill handle login forms and sessions?
Yes. Use fill and click actions for login forms. Enable session persistence with the storage_state option to reuse authentication across runs.

How does Playwright handle sites with bot detection?
Set stealth: true in the config to mask basic automation signals. More aggressive detection requires additional fingerprint spoofing libraries installed alongside the skill.

RN
R. Nakamura
Automation Engineer · aiagentsguides.com

R. Nakamura builds browser automation systems and covers OpenClaw's dev skills at aiagentsguides.com.

Get the OpenClaw Weekly

New guides, tips, and updates every week. Free forever.