🎉 Try Our Residential Proxies @ 1.25$/GB 🎉

Connect Puppeteer To BlitzBrowser

To connect Puppeteer to BlitzBrowser, you have to change the method puppeteer.launch() to puppeteer.connect({ ... }).

How to connect

To connect your code, you have to replace puppeteer.launch() with puppeteer.connect({ ... }). We suggest to pass the ACCESS_KEY as an environment variable to avoid hardcoding your access key directly in the code. The connect({ ... }) method establishes a connection between Puppeteer to a remote browser. Puppeteer 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 puppeteer from 'puppeteer';

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

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

// ...

await browser.close();

Connect Puppeteer to our residential proxies

You can also connect Puppeteer 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 Puppeteer to our residential proxies.

Puppeteer CDP Parameters

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