Auto-waiting
Actions and assertions wait for elements to appear or settle before they run, so tests read like intent instead of timing code.
Playwright-style ergonomics for CDP scripts, test suites, and browser workflows. Small npm package, explicit browser install, auto-waiting primitives, and a clean CLI.
cdpwright is built for teams that want Playwright-style browser automation without taking the whole multi-browser framework with them.
npm init -y
npm install @toolstackhq/cdpwright
npx cpw installimport { chromium, expect } from "@toolstackhq/cdpwright";
const browser = await chromium.launch({ headless: true });
const page = await browser.newPage();
await page.goto("https://example.com", { waitUntil: "load" });
await expect(page).element("h1").toHaveText(/Example Domain/);
await browser.close();For standalone scripts, chromium.withBrowser() keeps the lifecycle tidy:
import { chromium } from "@toolstackhq/cdpwright";
await chromium.withBrowser({ headless: true, logEvents: true }, async (browser) => {
const page = await browser.newPage();
await page.goto("https://toolstackhq.github.io/bluledger/login", { waitUntil: "load" });
await page.type("#customerId", "92718463");
await page.typeSecure("#password", "Harbour!92");
await page.click("#login-submit-button");
await page.expect("#dashboard-transfer-money-link").toBeVisible();
});If you want a test suite generated for the framework you already use, scaffold one after npm init -y:
npx cpw init test vitest
npx cpw init test mocha
npx cpw init test nodeThe scaffold writes a starter test, a local HTML fixture, and an npm test script. Vitest templates use the package's own assertion helper as cdpExpect, while Mocha and Node's built-in runner use assert.