Appearance
Usage
Core pattern
Replace your local browser launch with a WebSocket connection to Browserless. Your existing Playwright or Puppeteer script changes by one line.
Puppeteer -- get page title
js
import puppeteer from "puppeteer-core";
const TOKEN = process.env.BROWSERLESS_API_KEY;
async function getPageTitle() {
const browser = await puppeteer.connect({
browserWSEndpoint: `wss://production-sfo.browserless.io?token=${TOKEN}`,
});
const page = await browser.newPage();
await page.goto("https://www.example.com/");
const title = await page.title();
console.log(`The page title is: ${title}`);
await browser.close();
}
getPageTitle().catch(console.error);Playwright (Node.js) -- get page title
js
import { chromium } from "playwright-core";
const TOKEN = process.env.BROWSERLESS_API_KEY;
async function getPageTitle() {
const browser = await chromium.connectOverCDP(
`wss://production-sfo.browserless.io?token=${TOKEN}`
);
const context = await browser.newContext();
const page = await context.newPage();
await page.goto("https://www.example.com/");
const title = await page.title();
console.log(`The page title is: ${title}`);
await browser.close();
}
getPageTitle().catch(console.error);Playwright (Python)
python
from playwright.sync_api import sync_playwright
import os
TOKEN = os.environ["BROWSERLESS_API_KEY"]
with sync_playwright() as p:
browser = p.chromium.connect_over_cdp(
f"wss://production-sfo.browserless.io?token={TOKEN}"
)
page = browser.new_page()
page.goto("https://www.example.com/")
print(f"The page title is: {page.title()}")
browser.close()Self-hosted (Docker) -- same pattern, different endpoint
js
// Cloud endpoint: wss://production-sfo.browserless.io?token=TOKEN
// Local endpoint: ws://localhost:3000
const browser = await puppeteer.connect({
browserWSEndpoint: "ws://localhost:3000",
});Connection URL options
Append these as query parameters to the WebSocket URL:
| Parameter | Effect |
|---|---|
token=YOUR_KEY | Authentication (required for cloud) |
timeout=60000 | Override 30-second default session timeout (ms) |
solveCaptchas=true | Enable automatic CAPTCHA solving (costs 10 units/solve) |
stealth | Use /chromium/stealth path instead for anti-detect mode |
Stealth mode path
For anti-detect Chromium, change the path:
wss://production-sfo.browserless.io/chromium/stealth?token=TOKENREST API -- screenshot (one-shot, no SDK needed)
bash
curl -X POST \
"https://production-sfo.browserless.io/chromium/screenshot?token=$BROWSERLESS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url":"https://www.example.com"}' \
--output screenshot.png