Configuring and utilizing proxies in Puppeteer

Comments: 0

Puppeteer, a library for managing Chromium-based browsers like Microsoft Edge, uses the DevTools protocol through a high-level API. It programmatically controls Chrome, offering more than just a data scraping solution—it can simulate various browsing scenarios.

Using a proxy with Puppeteer provides many advantages, including IP privacy during web scraping and bypassing geo-restrictions.

Using a proxy in Puppeteer is straightforward; this popular tool for web scraping and parsing offers many useful advantages:

  • Collect accurate data by simulating profiles and locations.
  • Geo-testing: view website content targeted at any location.
  • Load balancing on servers, which improves the efficiency of website scraping.
  • Anonymity: the ability to integrate a proxy to change IP-addresses.
  • Bypassing restrictions on the number of requests from one IP address.

A step-by-step guide on how to set up a proxy in Puppeteer using Python

  1. If you already have a proxy, you'll need to configure the library to use it. Add the following code to the launch() method in your Puppeteer script.

    const proxy = 'http://:';

    const browser = await puppeteer.launch({

    args: ['--proxy-server=${proxy}'] ,


    After adding this code, Puppeteer will automatically utilize the proxy server for all its requests.

  2. Next, you need to install a proxy server in Puppeteer using Python. You need to pass a proxy to the launch() method of the Puppeteer class. An object of type ProxySettings has the following data:
    • Port;
    • Hostname or IP-address;
    • Username;
    • Password.

    Input the username and password if you're using private proxies with authorization.

    Here's a code:

    const puppeteer = require('puppeteer');

    (async () => {

    const browser = await puppeteer.launch({

    proxy: {

    host: '',

    port: '8080',

    username: 'username',

    password: 'password'



    const page = await browser.newPage();

    await page.goto('');

    await browser.close();


  3. With the “page.setProxy()” method in Puppeteer for Python, you can effectively use proxies by specifying a server for all page requests. The syntax is as follows:


    server: '',

    port: ,

    username: '',

    password: ''


Configuring a proxy server in Puppeteer automates browser tasks for efficient scraping and testing. It hides the user's IP address, allowing anonymous web browsing, which is useful for crawlers as it helps to bypass website restrictions based on IP-addresses. It also hides the user's location, protecting personal information from intruders and circumventing geographic restrictions and bans.