Skip to content
Dashboard
Integrations

Playwright

Connect Playwright to Lightcone browser sessions via Chrome DevTools Protocol.

Connect Playwright to Lightcone’s cloud browsers via Chrome DevTools Protocol (CDP). This gives you the full Playwright API running on Lightcone’s stealth-enabled, scalable browser infrastructure.

Terminal window
pip install tzafon playwright
playwright install chromium
Terminal window
npm install @tzafon/lightcone playwright
npx playwright install chromium
from tzafon import Lightcone
from playwright.sync_api import sync_playwright
client = Lightcone()
session = client.computers.create(kind="browser")
# Get the CDP endpoint from the session
cdp_url = session.endpoints.get("cdp")
with sync_playwright() as p:
# Connect Playwright to the remote browser
browser = p.chromium.connect_over_cdp(cdp_url)
page = browser.contexts[0].pages[0]
# Use the full Playwright API
page.goto("https://example.com")
page.fill("input[name='search']", "hello world")
page.click("button[type='submit']")
# Wait for results
page.wait_for_selector(".results")
content = page.inner_text("body")
print(content[:500])
browser.close()
client.computers.delete(session.id)
import Lightcone from "@tzafon/lightcone";
import { chromium } from "playwright";
const client = new Lightcone();
const session = await client.computers.create({ kind: "browser" });
const cdpUrl = session.endpoints?.cdp;
const browser = await chromium.connectOverCDP(cdpUrl!);
const page = browser.contexts()[0].pages()[0];
await page.goto("https://example.com");
await page.fill("input[name='search']", "hello world");
await page.click("button[type='submit']");
await page.waitForSelector(".results");
const content = await page.innerText("body");
console.log(content.slice(0, 500));
await browser.close();
await client.computers.delete(session.id!);
from tzafon import AsyncLightcone
from playwright.async_api import async_playwright
client = AsyncLightcone()
session = await client.computers.create(kind="browser")
cdp_url = session.endpoints.get("cdp")
async with async_playwright() as p:
browser = await p.chromium.connect_over_cdp(cdp_url)
page = browser.contexts[0].pages[0]
await page.goto("https://example.com")
# ...
await browser.close()
await client.computers.delete(session.id)
  • Full Playwright API — selectors, waiters, assertions, network interception, file uploads/downloads
  • Cloud execution — no local browser needed
  • Stealth & proxies — Lightcone’s anti-detection features
  • Scale — spin up hundreds of sessions in parallel
  • Browser-Use — AI web agents using Playwright + Lightcone
  • OpenAI CUA — OpenAI’s computer-use agent over CDP
  • Computers — Lightcone’s native API (no Playwright needed)