Skip to content
Skillpedia
Deploy & cloud (DevOps)9.9k · #12035

cloudflare-browser

What it does

This skill lets an AI agent drive a headless Chrome browser hosted on Cloudflare Workers. It is for developers who need screenshots, scraping or page recordings without running their own browser.

When to use it

  • ✓When you need a screenshot of a web page taken by a remote browser.
  • ✓When you want to scrape content from pages that need a real browser.
  • ✓When you want to record a video across several pages in sequence.

Skill link

https://github.com/cloudflare/moltworker/blob/main/skills/cloudflare-browser/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/cloudflare/moltworker/blob/main/skills/cloudflare-browser/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute →

Example of what to ask your AI

“Take a screenshot of our pricing page and save it as a PNG file.”

5 new skills a week. 1 minute to read.

How it works

The agent connects to a Chrome DevTools Protocol endpoint over WebSocket on a Cloudflare Worker, then sends commands to navigate, capture and read the page. Helper scripts handle screenshots and multi-page video.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

Cloudflare Browser Rendering

Control headless browsers via Cloudflare's Browser Rendering service using CDP (Chrome DevTools Protocol) over WebSocket.

Prerequisites

  • CDP_SECRET environment variable set
  • Browser profile configured in openclaw.json with cdpUrl pointing to the worker endpoint:
    "browser": {
      "profiles": {
        "cloudflare": {
          "cdpUrl": "https://your-worker.workers.dev/cdp?secret=..."
        }
      }
    }
    

Quick Start

Screenshot

node /path/to/skills/cloudflare-browser/scripts/screenshot.js https://example.com output.png

Multi-page Video

node /path/to/skills/cloudflare-browser/scripts/video.js "https://site1.com,https://site2.com" output.mp4

CDP Connection Pattern

The worker creates a page target automatically on WebSocket connect. Listen for Target.targetCreated event to get the targetId:

const WebSocket = require('ws');
const CDP_SECRET = process.env.CDP_SECRET;
const WS_URL = `wss://your-worker.workers.dev/cdp?secret=${encodeURIComponent(CDP_SECRET)}`;

const ws = new WebSocket(WS_URL);
let targetId = null;

ws.on('message', (data) => {
  const msg = JSON.parse(data.toString());
  if (msg.method === 'Target.targetCreated' && msg.params?.targetInfo?.type === 'page') {
    targetId = msg.params.targetInfo.targetId;
  }
});

Key CDP Commands

Command Purpose
Page.navigate Navigate to URL
Page.captureScreenshot Capture PNG/JPEG
Runtime.evaluate Execute JavaScript
Emulation.setDeviceMetricsOverride Set viewport size

Common Patterns

Navigate and Screenshot

await send('Page.navigate', { url: 'https://example.com' });
await new Promise(r => setTimeout(r, 3000)); // Wait for render
const { data } = await send('Page.captureScreenshot', { format: 'png' });
fs.writeFileSync('out.png', Buffer.from(data, 'base64'));

Scroll Page

await send('Runtime.evaluate', { expression: 'window.scrollBy(0, 300)' });

Set Viewport

await send('Emulation.setDeviceMetricsOverride', {
  width: 1280,
  height: 720,
  deviceScaleFactor: 1,
  mobile: false
});

Creating Videos

  1. Capture frames as PNGs during navigation
  2. Use ffmpeg to stitch: ffmpeg -framerate 10 -i frame_%04d.png -c:v libx264 -pix_fmt yuv420p output.mp4

Troubleshooting

  • No target created: Race condition - wait for Target.targetCreated event with timeout
  • Commands timeout: Worker may have cold start delay; increase timeout to 30-60s
  • WebSocket hangs: Verify CDP_SECRET matches worker configuration
FAQ

What setup is needed?

The skill requires a CDP_SECRET environment variable and a browser profile with a cdpUrl in the config.

Where do the screenshot scripts live?

They are in the skill's scripts folder, and the skill shows a sample command for them.

Does it work outside Cloudflare Workers?

The skill is written for a Cloudflare Workers setup, so it expects that environment.

Details

Original description by the author

Control headless Chrome via Cloudflare Browser Rendering CDP WebSocket. Use for screenshots, page navigation, scraping, and video capture when browser automation is needed in a Cloudflare Workers environment. Requires CDP_SECRET env var and cdpUrl configured in browser.profiles.

repo: cloudflare/moltworker

Popularity

GitHub stars
9.9k
Ranking position
#12035
License
Apache-2.0
Updated
5/8/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

Similar skills