Playwright attaches to a Surfsky browser through the session’s CDP WebSocket URL. Use connect_over_cdp in Python or connectOverCDP in the other languages instead of launching a browser. The browser runs in Surfsky’s cloud; no local Chromium is needed.
Standard Playwright creates utility worlds, helper scripts, and bindings that
detection scripts can identify. Use a patched fork such as Patchright or
rebrowser-playwright for sites with bot protection.
Prerequisites
Set your API token and base URL. The examples start a browser with an empty request body, which uses your account’s default proxy pool. Proxy, fingerprint, and other start options are in the API reference.
Run an example
Each example starts a one-time browser, connects, opens a page, prints its title, and closes the browser. To keep cookies and login state between runs, start a persistent profile instead; the connection code is the same.
Python
JavaScript
Java
.NET
Save as surfsky_playwright.py: Requires Node.js 22 or newer.Save as surfsky-playwright.mjs: Add Playwright to your project using the official instructions. Start a browser with the REST quickstart and export the returned ws_url as SURFSKY_WS_URL. Start a browser with the REST quickstart and export the returned ws_url as SURFSKY_WS_URL. Put this in Program.cs:Run with dotnet run.
Expected output:
Stop the session
Playwright’s browser.close() only disconnects from a browser attached over CDP. Stop the session either through CDP, as the examples do:
or through the API with the internal_uuid from the start response:
Otherwise the browser stops after the inactivity timeout, 30 seconds by default.