Skip to content

Cloudflare Browser Run adds a /script endpoint for custom automation

Browser Run can now run arbitrary Playwright, Puppeteer or raw CDP scripts against a hosted Chrome instance, not just its fixed snapshot and PDF endpoints. Sessions stay open between calls.

Source: Cloudflare

Cloudflare added /script and /script/<sessionId> endpoints to Browser Run, its hosted headless-browser service. Until now, Browser Run only offered fixed-purpose endpoints such as /snapshot and /pdf. The new endpoint instead takes a JavaScript function, written against Playwright, Puppeteer or the raw Chrome DevTools Protocol, runs it in an isolated Worker connected to a real browser session, and returns the result as { "success": true, "result": ... }.

POST /script acquires a fresh browser and runs your function once. POST /script/<sessionId> runs a follow-up script against a session you already hold, with the session ID returned in the cf-browser-session-id response header. Sessions stay open after a script finishes, so you need to close them explicitly with DELETE /devtools/browser/<sessionId> or browser.close(), or let them hit the idle timeout. Workers can call it directly through the browser binding, and there’s a dashboard tool called Script Studio for writing and testing scripts without an API token.

const result = await env.BROWSER.script(async (page) => {
  await page.goto('https://example.com')
  return page.title()
})

Why it matters: if you have been running your own Puppeteer or Playwright cluster to scrape pages, drive end-to-end tests, or give an agent a browser to act in, this removes the infrastructure for that and lets you keep the automation code you already have. Browser Run’s other endpoints are still there if a fixed shape is all you need.

Share

More from The Wire

All briefs

A Linux KVM bug let one VM read 127GB of host memory

A bug bounty researcher used a four-year-old stale pointer in nested virtualization to read host kernel memory from inside an ordinary cloud VM. DigitalOcean disclosed and patched it as CVE-2026-99312.

via DigitalOcean