For Browserless, connect with playwright.chromium.connectOverCDP('wss://<browserless-host>/chromium?token=<your-token>') to attach to a managed Chromium instance over the Chrome DevTools Protocol
For Playwright-native features (page.route(), non-Chromium browsers), use playwright.chromium.connect('wss://<browserless-host>/playwright/chromium?token=<your-token>') instead of connectOverCDP
For Browserbase, create a session first via their Sessions API (POST request returning a session object), then connect using the connectUrl from the session response
After connecting, use the resulting browser object exactly as a locally launched browser: create contexts, open pages, and run assertions normally
Implement retry logic around the connect call because cloud browser pools can return a 429 or timeout if all slots are busy; use exponential backoff with a configurable max-retry count
Known gotchas
connectOverCDP() gives raw CDP access but loses Playwright-native features like page.route() and non-Chromium support — prefer connect() unless you specifically need CDP events
Cloud sessions have a maximum duration and idle timeout; ensure your automation completes or sends keep-alive activity before the session is forcibly closed
Do not hardcode tokens in source; read them from environment variables and never log the WebSocket URL, as it contains the credential
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp