Skip to content
ProxyHub
All guides

Browser automation

Use the proxy with Puppeteer

In Puppeteer the proxy is passed to Chrome with the --proxy-server argument, while the username and password are provided per page with page.authenticate().

Step by step

  1. 1

    Set the proxy protocol to HTTP in the client area: Chrome doesn't support authentication on SOCKS5 proxies.

  2. 2

    Launch the browser with --proxy-server=http://HOST:PORT (no credentials in the address).

  3. 3

    On every new page call page.authenticate() with username and password before page.goto().

  4. 4

    To change IP, call the rotation link, wait about 20 seconds and carry on browsing.

JavaScript (Node.js)
import puppeteer from "puppeteer";

const browser = await puppeteer.launch({ args: ["--proxy-server=http://HOST:PORT"] });
const page = await browser.newPage();
await page.authenticate({ username: "USER", password: "PASSWORD" });

await page.goto("https://api.ipify.org");
console.log(await page.$eval("body", (b) => b.textContent));
await browser.close();

Replace USER, PASSWORD, HOST and PORT with your proxy's data (client area › proxy › Connection).

Tips

Don't have a proxy yet?

Choose country, carrier and plan: the proxy activates right away.

See plans

Need a hand?

Dedicated 24/7 support on Telegram helps you set up any tool.

Message us on Telegram

More guides