🎉 Try Our Residential Proxies @ 1.25$/GB 🎉

Connect Playwright To BlitzBrowser

To connect Playwright to BlitzBrowser, you have to change the method launch() to connectOverCDP(`...`).

How to connect

To connect your code, you have to replace launch() with connectOverCDP(`...`). We suggest to pass the ACCESS_KEY as an environment variable to avoid hardcoding your access key directly in the code. The connectOverCDP(`...`) method establishes a connection between Playwright to a remote browser. Playwright will get full control of one of our browsers via the Chrome DevTools Protocol (CDP). Once you disconnect from the browser, the remote browser is killed.

import { chromium } from 'playwright';

// const browser = await chromium.launch();
const browser = await chromium.connectOverCDP(
    `wss://cdp.blitzbrowser.com?accessKey=${process.env.ACCESS_KEY}`
);

const context = await browser.newContext();
const page = await context.newPage();

// ...

await browser.close();

Connect Playwright to our residential proxies

You can also connect Playwright to our residential proxies when connecting to our browsers. It is super simple and it increases the stealth of your browser. Learn how to connect Playwright to our residential proxies.

Playwright CDP Parameters

You can find all the parameters available to configure your Chrome DevTools Protocol URL when connecting to our browsers here.