Skip to main content
Playwright connects to a Surfsky browser over the session’s CDP WebSocket URL instead of launching one itself. The browser runs in Surfsky’s cloud, so you do not need Chromium on your machine.
Playwright has known leaks that anti-bot scripts can detect. On sites with bot protection, use a patched fork such as Patchright or rebrowser-playwright.
Use human-emulation commands for clicks, typing, and scrolling. Keep Playwright for navigation, selectors, waiting, and page content.

Prerequisites

Set your API token and base URL. The examples use your account’s default proxy pool. Proxy, fingerprint, and other start options are in the API reference.

Run an example

The examples use a one-time profile. To reuse a saved login, pass a persistent profile UUID to the session call instead.
Requires Python 3.12 or newer.
Save as surfsky_playwright.py:
Run it:
Expected output:

Click, type, and scroll

Prefer human emulation over Playwright’s own click, fill, and scroll. Human.* commands move the cursor and type with human timing, and they run through a page-level CDP session. Replace the selector with an input on your page:

Stop the session

Playwright’s browser.close() only disconnects from a browser attached over CDP. Without the SDK, stop it through CDP as the Java and .NET examples do. In async Python:
or through the API with the internal_uuid from the start response:
Otherwise the browser stops after the inactivity timeout.