Browsers

Remote headless browser sessions (Chrome or Lightpanda) you drive over CDP with Playwright or Puppeteer, with an optional live view.


A browser session is a managed remote browser. You create one, connect to it over the Chrome DevTools Protocol (CDP) with Playwright, Puppeteer or any CDP client, and release it when you are done. Two engines:

EngineUse it for
chromefull Chromium: screenshots, scrolling, extensions-free automation, live view
lightpandafast, lightweight page loads and scraping (no rendering, no screenshots, no live view)

How long until ready (production, November 2026): about 6-12 s for either engine when the host is idle. Under load it is slower, because a new session waits behind other sessions being torn down on the same host. With two sessions starting at a time, Chrome took p50 21 s / p95 57 s and Lightpanda p50 18 s / p95 38 s. We are working on this. Once a session is ready, connecting over CDP takes about 1 s, loading a page 0.2-0.4 s and releasing about 0.5 s. Since 0.1.0-beta.6 the SDKs check a starting session at most 1 s apart (it was 3 s), so your code sees it ready about 1.5 s after the server does (p95 1.9 s, was p50 2.6 s / p95 4.0 s).

Create, connect, release#

// npm install ./sdk/sandal-typescript-v0.1.0-beta.16.tgz playwright-core
import { chromium } from "playwright-core";
import { Sandal, connectSandalBrowser, sandalPlaywrightAdapter } from "@sandal-dev/sdk";

const sandal = Sandal.fromEnv();
const session = await sandal.browsers.createAndConnect({ browserSessionCreateRequest: { engine: "chrome" }, lifetimeMs: 10 * 60_000 });
try {
  const attached = await connectSandalBrowser({
    connection: session.connection,
    sessionId: session.sessionId,
    gatewayOrigin: "wss://api.sandal.dev",
    authorization: `Bearer ${process.env.SANDAL_API_KEY}`,
    adapter: sandalPlaywrightAdapter(chromium),
  });
  try {
    const context = attached.browser.contexts()[0] ?? (await attached.browser.newContext());
    const page = context.pages()[0] ?? (await context.newPage());
    await page.goto("https://en.wikipedia.org/wiki/Sandal");
    console.log(await page.title());
    await page.screenshot({ path: "page.png" });
  } finally {
    await attached.disconnect();
  }
} finally {
  await sandal.browsers.release({ sessionId: session.sessionId });
}

Live view and CDP#

There are two ways in, and they do different jobs:

  • CDP is for code. Playwright, Puppeteer or any CDP client connects to connection.webSocketUrl with your API key and drives the browser: any URL the page itself can open, scripts, screenshots, network interception.
  • Live view is for a person. The Console's Browsers page streams the session's Chrome tab as video and lets you Take control: click, type, scroll and enter an address. From code, sandal.browsers.liveViewTicket({ sessionId }) mints a single-use ticket for the live view where it is enabled. Live view works for Chrome only.

The live view address bar takes http and https addresses only. A data:, file:, javascript: or chrome: address is refused with "Enter an http or https address". CDP has no such rule: your automation can open a data: page.

Limits and good practice#

  • Always release sessions: an unreleased session runs until its expiry.
  • One CDP client per session at a time.
  • Lightpanda does not render pixels: no screenshots, no live view.
  • A session that cannot start reports failed (it is cleaned up for you); create a new one.