How to use Puppeteer with the Ladybird browser
Puppeteer does not work with Ladybird yet because Ladybird has no Chrome DevTools Protocol. Use its WebDriver server to automate it and take screenshots.
Ladybird is a new web browser with its own engine. It is not based on Chromium, WebKit or Gecko. The engine is written from scratch against web standards: LibWeb handles HTML, CSS and the DOM, and LibJS runs JavaScript. The Ladybird Browser Initiative, a non-profit funded by donations, builds it. The project is in alpha, with builds for Apple Silicon Macs and Linux.
Puppeteer does not support Ladybird yet
Puppeteer controls Chrome through the Chrome DevTools Protocol (CDP). Ladybird does not implement CDP, so Puppeteer cannot drive it the way it drives Chrome.
Puppeteer can also use WebDriver BiDi, which it uses for Firefox. Ladybird has some BiDi support, but in ScreenshotOne’s tests Puppeteer still failed to connect with A session already exists. Until that changes, use WebDriver to automate Ladybird.
Take a screenshot with WebDriver
Ladybird ships a W3C WebDriver server next to the browser executable. In current macOS builds it is called WebDriver; newer source builds call it ladybird-driver. Start it on a local port:
WebDriver --headless --listen-address 127.0.0.1 --port 4444
WebDriver is a plain HTTP API, so Node.js fetch is enough. This script opens a headless session, loads a page, saves a viewport screenshot and closes the session:
import { writeFile } from "node:fs/promises";
const server = "http://127.0.0.1:4444";
async function call(method, path, body) {
const response = await fetch(server + path, {
method,
headers: { "Content-Type": "application/json" },
body: body ? JSON.stringify(body) : undefined,
});
const { value } = await response.json();
if (!response.ok) throw new Error(`${value.error}: ${value.message}`);
return value;
}
const { sessionId } = await call("POST", "/session", {
capabilities: { alwaysMatch: { "ladybird:headless": true } },
});
try {
const session = `/session/${sessionId}`;
await call("POST", `${session}/window/rect`, { width: 1280, height: 800 });
await call("POST", `${session}/url`, { url: "https://example.com/" });
const png = await call("GET", `${session}/screenshot`);
await writeFile("page.png", Buffer.from(png, "base64"));
} finally {
await call("DELETE", `/session/${sessionId}`);
}
The navigation command returns after the page load completes. If your page renders content later, wait for an element (for example, poll POST /session/{id}/element) before taking the screenshot.
You can also use Selenium with browserName: "ladybird" and the same ladybird:headless capability, pointing it at the server with usingServer("http://127.0.0.1:4444").
The ScreenshotOne write-up covers the rest: a one-command headless screenshot without WebDriver, a full WebDriver script that waits for elements, a known bug where element screenshots return the wrong area, and how Ladybird screenshots compare to Chrome.
For screenshots in Chrome with Puppeteer, see Puppeteer screenshots.
Ladybird makes no security promises yet. Use a temporary profile and open only pages you trust.