Skip to Content
UsageCDPPuppeteer

Puppeteer

Use Lightpanda with Puppeteer via the Chrome DevTools Protocol (CDP).

More examples in demo/puppeteer.

Start Lightpanda as a local CDP server (see serve command for all options):

./lightpanda serve --host 127.0.0.1 --port 9222

Connect Puppeteer using browserWSEndpoint — the WebSocket URL Puppeteer uses to attach to an already-running browser instead of launching one itself:

'use strict' import puppeteer from 'puppeteer-core' const browser = await puppeteer.connect({ browserWSEndpoint: 'ws://127.0.0.1:9222', }) const context = await browser.createBrowserContext() const page = await context.newPage() await page.goto('https://wikipedia.com/') const title = await page.title() console.log(title) await page.close() await context.close() await browser.disconnect()