Skip to content

Playwright Proxy: One Authenticated IP per Browser Context

Give every Playwright worker its own exit IP — a fixed datacenter IP for tests, a household IP when the site blocks servers.

Why Playwright needs a proxy

Playwright drives a real browser, but every page it loads still leaves from your machine's IP. Run many contexts from one server and the site sees one address doing the work of many visitors. The usual reply is HTTP 429 Too Many Requests — the server telling you to slow down — or a block.

Proxy support is built in. You can set one proxy for the whole browser or a separate proxy for each browser context, so parallel workers leave through different IPs. Playwright documents the username and password fields for HTTP proxies.

Use HTTP for password-protected proxies in Chromium. Chrome supports no authentication method for SOCKS5 and won't use credentials written into proxy settings, so a socks5:// server with a password fails in Chromium even though Playwright accepts socks5:// addresses.

Recommended Playwright setup

Scroll horizontally with the arrow keys to read all content.

Recommended Playwright setup
CriterionChooseWhy
ProductStatic datacenter proxyFastest and cheapest per IP, fixed for the whole term — right for test runs, CI and sites that accept server IPs
If the site blocks serversRotating residential, Budget lineReal household IPs from US$1.50/GB; you pay for traffic, not per IP
How many IPsOne per parallel worker (browser context)Workers stop sharing one address and one rate limit
CountryWhere your users are: US, CA, GB, DE, NL, JP, KR or SG for datacenterSites that adapt to location show each country its own version
ProtocolHTTPChromium can't send a SOCKS5 password; HTTP authenticates in every Playwright browser
IP changesDatacenter: never during the termRenew in My assets to keep the same IP

The button below opens Static Datacenter Proxies with the AI and automation use case. Choose Region, Term, Protocol and Quantity (up to 100 IPs at a time) before you pay.

Which Proxy302 proxy to buy

Scroll horizontally with the arrow keys to read all content.

Which Proxy302 proxy to buy
CriterionStatic ISPRotating residentialDatacenter
What you getA dedicated home-broadband IP that stays yours for the whole termReal household IPs: rotating exits, or a sticky session in a chosen country or cityFast fixed server IPs, HTTP and SOCKS5
PricePer IP and term — live price at checkoutBudget US$1.50/GB (US$1.35/GB at 100 GB); Premium US$5.00/GBPer IP and term — the cheapest per IP
Best for PlaywrightLogged-in flows that must keep one IP for weeksScraping sites that block server IPsCI, end-to-end tests and fast batch jobs

Prices in US dollars. Top up your wallet once and pay any line from it. Nothing renews automatically — renew in My assets to keep an IP.

Set up Playwright proxies in 5 steps

  1. Choose the region and term

    The button below opens Static Datacenter Proxies (Per IP and term) with the AI and automation use case. Under Connection settings pick the Region, choose a Term and set Protocol to HTTP. Set Quantity to the number of IPs you need (one for each parallel worker, up to 100 at a time). Then click Review cost and generate.

  2. Copy each IP

    In My assets, Copy gives a ready line in host:port:user:password form. Put host and port in PROXY_HOST and PROXY_PORT, user and password in PROXY_USER and PROXY_PASS — environment variables keep the password out of your code.

  3. Add the proxy to Playwright

    Use the code below. A proxy on newContext() gives each worker its own IP; a proxy on launch() applies one IP to the whole browser. The server must be http://host:port.

  4. Check the exit IP

    The script opens api.ipify.org and prints the IP the site sees.

    Expected result The printed IP is the proxy's address, not your server's.

  5. If a site blocks datacenter IPs

    Open Rotating Residential Proxies instead: set Line to Budget, use Add traffic to buy a package (from 1 GB), then set Exit mode to Global rotation for new exits on new connections, or to Choose region / sticky IP to stay in one country or city. Rotating residential connects through proxy.proxy302.com:2222 for HTTP.

Playwright proxy with username and password (Node.js)

Scroll horizontally with the arrow keys to read all content.

// npm i playwright   then   npx playwright install chromium
import { chromium } from 'playwright'

// From Proxy302 → My assets → Copy (host:port:user:password)
const { PROXY_HOST, PROXY_PORT, PROXY_USER, PROXY_PASS } = process.env

const browser = await chromium.launch()
// One proxy per browser context: each parallel worker gets its own exit IP
const context = await browser.newContext({
  proxy: {
    server: `http://${PROXY_HOST}:${PROXY_PORT}`, // HTTP: Chromium can't send a SOCKS5 password
    username: PROXY_USER,
    password: PROXY_PASS,
  },
})
const page = await context.newPage()
await page.goto('https://api.ipify.org?format=json')
console.log(await page.textContent('body')) // {"ip":"..."}: the proxy's exit IP, not your server's
await browser.close()

Checked on 2026-10-18 with Playwright 1.63.0 and Chromium 153 against a local password-protected proxy: the right credentials loaded the page, a wrong password loaded nothing. Swap the IP-check URL for your target.

The same in Python

Scroll horizontally with the arrow keys to read all content.

# pip install playwright   then   playwright install chromium
import os
from playwright.sync_api import sync_playwright

# From Proxy302 → My assets → Copy (host:port:user:password)
proxy = {
    "server": f"http://{os.environ['PROXY_HOST']}:{os.environ['PROXY_PORT']}",
    "username": os.environ["PROXY_USER"],
    "password": os.environ["PROXY_PASS"],
}

with sync_playwright() as p:
    browser = p.chromium.launch(proxy=proxy)  # or browser.new_context(proxy=proxy) per worker
    page = browser.new_page()
    page.goto("https://api.ipify.org?format=json")
    print(page.text_content("body"))  # the proxy's exit IP
    browser.close()

Playwright for Python takes the same proxy dictionary in launch() or new_context(). Syntax-checked; the Node.js version above was run end to end.

Quick fixes

407 Proxy Authentication Required

Check Do the username and password match the line in My assets? In Chromium, does the server start with http:// rather than socks5://?

Fix Copy the line again and paste host:port into server and the other two parts into username and password. These fields don't need URL encoding.

The page still shows your server's IP

Check Is the proxy set on the context that opened the page? Is the host listed in bypass?

Fix Set proxy on that newContext() (or on launch()) and remove the host from bypass.

Timeouts or net::ERR_PROXY_CONNECTION_FAILED

Check Is the IP active and unexpired in My assets? Does curl -x http://USER:PASS@HOST:PORT https://api.ipify.org work from the same machine?

Fix Renew or replace the IP. If curl fails too, the machine can't reach the proxy — check its firewall or outbound rules.

429s or a challenge page after a while

Check Are several contexts sharing one IP? How fast are pages loading?

Fix Give each context its own IP, slow down, or move that site to rotating residential.

Playwright proxy FAQ

How do I set a proxy in Playwright?

Use the proxy option with server, username and password — in launch() for the whole browser or in newContext() for one context. It works the same way in Node.js, Python, Java and .NET.

Does Playwright support SOCKS5 with a password?

Playwright accepts socks5:// servers, but Chromium can't authenticate to SOCKS5. For a password-protected Proxy302 line, use its HTTP endpoint.

How do I rotate IPs in Playwright?

Open a new context with a different proxy for each worker or session. With rotating residential and Exit mode set to Global rotation, new connections can leave through new exits; for a proxy held in one region, Rotate in My assets changes its IP.

Residential or datacenter for Playwright?

Datacenter when the site accepts server IPs — it's the fastest and cheapest per IP. Rotating residential when the site blocks or keeps challenging server IPs.

Can npx playwright install download browsers through a proxy?

Yes. Playwright documents installing behind a proxy: set HTTPS_PROXY to your proxy URL before running npx playwright install.

Sources and verification

8
  1. Playwright docs — Network: HTTP proxy

    Official documentation · Checked:

  2. Playwright API — browserType.launch(): proxy option

    Official documentation · Checked:

  3. Chromium — Proxy support in Chrome

    Official documentation · Checked:

  4. Playwright docs — Install behind a firewall or a proxy

    Official documentation · Checked:

  5. MDN — 429 Too Many Requests

    Official documentation · Checked:

  6. Proxy302 pricing

    Product observation · Checked:

    Rotating residential per-GB prices as published on the pricing page and used by the console (Budget US$1.50/GB, US$1.35/GB in the 100 GB package; Premium US$5.00/GB; 1 PTC = US$1). Static ISP and datacenter IPs are quoted live per IP and term.

  7. Proxy302 console — Static Datacenter Proxies

    Product observation · Checked:

    Option names, billing modes and limits as shown in the live console on 2026-10-18: Line (Premium/Budget), Exit mode, Region, State, City, Protocol (HTTP/SOCKS5), Quantity (1–500), Term, Auto-renew IP (not yet available), My assets → Copy / Rotate / Renew / Copy for AI. Rotating residential connects through proxy.proxy302.com:2222 (HTTP) and :3333 (SOCKS5). Static datacenter IPs were sold in 8 countries on 2026-10-18 (read-only check of the production catalogue): US, CA, GB, DE, NL, JP, KR, SG.

  8. Local proxy fixture run

    Local example · Checked:

    The code block was executed on 2026-10-18 against a local password-protected HTTP proxy that answers 407 without valid credentials; Playwright 1.63.0 with Chromium 153: the right credentials loaded the page through the proxy, a wrong password loaded nothing.

    A local check proves the configuration syntax and authentication path, not access to any specific website, country or platform.

Ready to connect?

Create an account, top up once and pick rotating residential, static ISP or datacenter. Rotating residential exits cover 195+ countries and regions.