cloudflare-browser
Control headless Chrome via Cloudflare Browser Rendering using CDP. Capture screenshots, navigate pages, automate scraping, and generate videos in a Cloudflare Workers environment.
Introduction
The cloudflare-browser skill provides a robust interface for orchestrating headless browser operations within the Cloudflare Workers ecosystem. By leveraging the Chrome DevTools Protocol (CDP) over WebSockets, this tool enables developers to treat a managed browser as a programmable resource for complex automation tasks. It is specifically designed for agents that require visual confirmation, web content extraction, or high-fidelity page rendering that standard HTTP requests cannot achieve. Typical users include software engineers, automation specialists, and data researchers who need to interact with dynamic, JavaScript-heavy websites programmatically. Whether you are performing automated regression testing, generating dynamic visual assets, or scraping structured data, this skill offers the necessary low-level control over browser state and rendering lifecycle.
-
Full CDP integration: Execute standard Chrome DevTools commands including Page navigation, Runtime evaluation, and Emulation settings.
-
Automated visual capture: Native support for capturing high-resolution PNG/JPEG screenshots and stitching multi-page sequences into MP4 video files.
-
Viewport management: Granular control over browser device metrics, allowing for mobile-responsive testing and custom window dimension simulation.
-
Real-time event handling: Subscribe to target events like Target.targetCreated to monitor page lifecycle and state changes during navigation.
-
Cloudflare infrastructure integration: Optimized for Workers environments, ensuring efficient WebSocket communication with the browser rendering backend.
-
Prerequisites: Requires a valid CDP_SECRET environment variable and a properly configured cdpUrl within your browser profiles.
-
Inputs: Accepts standard navigation URLs, CSS selectors for interaction, and raw JavaScript expressions via Runtime.evaluate.
-
Outputs: Generates binary image buffers, base64-encoded screenshots, or temporary frame files for video post-processing with ffmpeg.
-
Constraints: Be aware of cold start latencies associated with the Cloudflare Sandbox environment; implement timeouts in the range of 30-60 seconds for production-grade reliability.
-
Best practices: Utilize the provided cdp-client.js wrapper to abstract common boilerplate, such as message ID tracking and promise-based response handling, to simplify script development.
Repository Stats
- Stars
- 9,875
- Forks
- 1,784
- Open Issues
- 93
- Language
- TypeScript
- Default Branch
- main
- Sync Status
- Idle
- Last Synced
- Apr 30, 2026, 04:59 PM