· rangkumin.tech

Cloudflare Browser Run adds /script endpoints that execute Playwright or CDP code in one API call

Cloudflare's Browser Run can now run browser automation written with Playwright, Puppeteer or raw Chrome DevTools Protocol in a single API request. The new /script endpoints execute a submitted JavaScript function inside an isolated Worker connected to a browser session.

Why it matters

The code runs in an isolated Worker connected to a browser session, so developers do not need to deploy a Worker. The response returns the function's result, and the session and page come back in the cf-browser-session-id and cf-browser-target-id headers, except for Kitesurf runs.

Follow-up scripts can be sent to a session you already hold, from /script or from /devtools/browser, and launch options such as keep_alive, recording and lab travel in the query string. A browser parameter runs a CDP script on Kitesurf.

From a Worker, the same endpoints can be called through the browser binding with env.BROWSER.script(), without an API token, and Script Studio in the dashboard runs scripts against a live browser. Neither endpoint closes the session afterwards, so callers must close it or let it reach its idle timeout.

Sources

Choose English or Indonesian. Up to two editions a day. Unsubscribe anytime.