What is Puppeteer?

Think of Puppeteer as a remote control for headless browsers. With just a few lines of Node.js code, you can direct browsers to gather information, run tests, and automate routine actions. It’s all about turning tough, time-consuming workflows into quick, manageable steps.

Maintain a consistent IP throughout your browser session by using the -session parameter in your username. This is essential because BrightData proxies default to rotating IPs with each request. Learn more

New users should begin with ISP or Data Center proxies, as residential proxies are incompatible with browser integration in Immediate-Access mode .

For use-cases related to account management, use a consistent static dedicated IP for each account you are managing. dedicated ISP proxies should be used for this.

How to Integrate Bright Data With Puppeteer

Getting Started

Before integrating Bright Data, ensure you have the essentials:

1. Node.js: Install the latest version from nodejs.org.

2. Project Setup: Use a code editor you prefer (such as VS Code) and initialize a Node.js project.

3. Puppeteer: Add Puppeteer to your project by running:

npm install puppeteer

Retrieve Your Bright Data Credentials

Sign in to your Bright Data dashboard and note down your proxy details:

Host

Port

Username

Password

These credentials will let Puppeteer route traffic through Bright Data’s secure, anonymous proxy network.

Configure Puppeteer for Bright Data

To connect Puppeteer with Bright Data:

1. Set the Proxy Server: Add --proxy-server=[HOST]:[PORT] to Puppeteer’s launch arguments.

2. Authenticate: Use page.authenticate() in Puppeteer to provide your Bright Data username and password.

Example Code

Here’s a sample script to guide you:

const puppeteer = require('puppeteer');

(async () => {
  // Launch Chromium with the Bright Data proxy configured
  const browser = await puppeteer.launch({
    headless: false,  // Change to true if you prefer headless mode
    args: ['--proxy-server=[HOST]:[PORT]'] // Replace with your Bright Data host and port
  });

  const page = await browser.newPage();

// Log in with your Bright Data credentials
  await page.authenticate({
    username: '[USERNAME]',   // Replace with your Bright Data username
    password: '[PASSWORD]'    // Replace with your Bright Data password
  });

 // Test the setup by visiting an IP-checking site
  await page.goto('http://httpbin.org/ip');
  // Capture a screenshot to confirm everything’s working
  await page.screenshot({path: 'example.png'});

  await browser.close();
})();

With Bright Data proxies integrated into Puppeteer, you gain secure and private browsing for all your automated tasks. Enjoy smoother data collection, reduced detection risks, and a more reliable workflow—so you can focus on insights and results, not on technical roadblocks.