Skip to content
ProxyHub
All guides

Browser automation

Use the proxy with Playwright

Playwright takes the proxy straight at browser launch, credentials included. It's the easiest way to automate a browser through an authenticated proxy.

Step by step

  1. 1

    Set the proxy protocol to HTTP in the client area: Chromium doesn't support username/password authentication on SOCKS5 proxies.

  2. 2

    Pass server, username and password in the proxy option of chromium.launch() (or browser.newContext() to use a different proxy per context).

  3. 3

    Open an IP-check page to confirm traffic goes through the proxy.

  4. 4

    For a new IP close the context, call the rotation link, wait about 20 seconds and open a new context.

JavaScript (Node.js)
import { chromium } from "playwright";

const browser = await chromium.launch({
  proxy: { server: "http://HOST:PORT", username: "USER", password: "PASSWORD" },
});
const page = await browser.newPage();
await page.goto("https://api.ipify.org");
console.log(await page.textContent("body"));
await browser.close();

// Python: p.chromium.launch(proxy={"server": "http://HOST:PORT", "username": "USER", "password": "PASSWORD"})

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