Playwright proxy setup

Playwright is one of the most common HTTP clients in scraping stacks. Point it at a PinguProxy endpoint and every request it makes exits through your proxy IP — static or rotating, over HTTP or SOCKS5.

Why use proxies with Playwright

Direct requests expose your home IP and get rate-limited fast. With Playwright behind PinguProxy, retries and bursts come from proxy IPs instead, so targets see distributed traffic instead of one noisy client.

What you can do

  • Keep one static IP per job so a target can whitelist or cookie you consistently.
  • Rotate per request with SOCKS5h so scraping bursts look like real distributed traffic.
  • Pool sessions with retries for long-running jobs that survive 429s and timeouts.
  • Use IPv4 or IPv6 exits depending on what the target infrastructure supports.

Setup snippets

Replace username, password, and port with the credentials from your dashboard. All examples route both HTTP and HTTPS traffic through the proxy.

Launch with HTTP proxy
const { chromium } = require("playwright");
const browser = await chromium.launch({
proxy: {
server: "http://username:password@proxy.pinguproxy.com:12933",
},
});
const page = await browser.newPage();
await page.goto("https://pinguproxy.com/ip");
console.log(await page.textContent("body"));
await browser.close();
Rotating SOCKS5 proxy
const { chromium } = require("playwright");
// SOCKS5h: use the socks5:// scheme and Playwright keeps DNS on the proxy.
const browser = await chromium.launch({
proxy: {
server: "socks5://username:password@proxy.pinguproxy.com:12933",
},
});
const context = await browser.newContext();
const page = await context.newPage();
await page.goto("https://pinguproxy.com/ip");
console.log(await page.textContent("body"));
await browser.close();
Per-context proxy (Python)
from playwright.sync_api import sync_playwright
with sync_playwright() as p:
browser = p.chromium.launch()
context = browser.new_context(proxy={
"server": "http://username:password@proxy.pinguproxy.com:12933",
})
page = context.new_page()
page.goto("https://pinguproxy.com/ip")
print(page.inner_text("body"))
browser.close()

The port shown (12933) is the default example; your dashboard lists the exact endpoints for your proxies. SOCKS5h keeps DNS lookups on the proxy so your real DNS server never sees the target domains.

Frequently asked questions

Does Playwright support SOCKS5?

Yes — modern Playwright bundles the socks support needed for socks5h:// URLs; just install requests[socks] if your environment asks for it.

How do I rotate IPs per request with Playwright?

Point Playwright at the rotating SOCKS5h endpoint: each new connection picks a fresh exit IP, while sticky sessions keep one IP until you ask for a new one.

Can I keep the same IP for a whole scraping session?

Yes. Use the static HTTP endpoint and the same proxy URL for every request — the exit IP stays fixed until you switch proxies in the dashboard.

Other setup guides

Ready to connect Playwright?

Create a proxy in the dashboard and paste your credentials into the snippets above — unlimited bandwidth on every plan.