Use a residential proxy in Playwright: open a context and check an authorized page

Put console host, port, and auth into Playwright’s proxy option. Check an authorized page first, then add rotation or sticky. Fake placeholders only. Render real code blocks. Not for mainland China.

Put console host, port, and auth into Playwright’s proxy option. Check an authorized page first, then add rotation or sticky. Fake placeholders only. Render real code blocks. Not for mainland China.

This page shows how to put protocol, host, port, and auth from the console into Playwright and check a page you are allowed to open. It is not the localization solutions page, and it is not the antidetect field checklist. If you need an HTTP client rather than browser automation, see Python requests.

Protocol choice: HTTP / SOCKS5 setup. Commands follow Docs EN quickstart. ZTProxy sells rotating residential (per GB) and static residential (per IP·month). Every example uses fake placeholders. Not for mainland China.

How this page differs from nearby guides

JobStart here
Choosing rotating vs static for localization previewsLocalization testing
Filling AdsPower / GoLogin fieldsAntidetect wiring
Launching a Playwright context in codeThis page
Sending HTTP requests with requestsPython guide

What to have ready

  1. Rotating or static already chosen in the console (rotating vs static), with protocol, host, port, username, and password copied.
  2. Node.js and Playwright available locally.
  3. An HTTPS page you may open (for example your own preview). Do not automate sites you do not have rights to.

Placeholders (not production): host `proxy.example.invalid`, port `10000`, user `USER_EXAMPLE`, password `PASS_EXAMPLE_NOT_REAL`.

Set proxy on launch

Keep credentials in environment variables, not in git. The `server` scheme and port must match the console. The sample uses an HTTP proxy.

import { chromium } from "playwright";

const host = process.env.ZT_PROXY_HOST ?? "proxy.example.invalid";
const port = process.env.ZT_PROXY_PORT ?? "10000";
const username = process.env.ZT_PROXY_USER ?? "USER_EXAMPLE";
const password = process.env.ZT_PROXY_PASS ?? "PASS_EXAMPLE_NOT_REAL";

const browser = await chromium.launch({
  proxy: {
    server: `http://${host}:${port}`,
    username,
    password,
  },
});

const context = await browser.newContext();
const page = await context.newPage();
await page.goto("https://example.com", { timeout: 30_000 });
console.log(await page.title());
await browser.close();

If the console returns SOCKS5, change `server` to the scheme it documents (for example `socks5://`). Do not assume UDP is available. If a region parameter exists, use only the form the console shows—do not invent username rules.

Sticky, rotation, and contexts

A `browser` or `context` may reuse the connection to the gateway. That is not a static IP, and it is not automatically a console sticky parameter. For a term-long relatively fixed exit, buy static. For a short held exit, follow the console session notes and read sticky vs static.

Common issues

SymptomCheck first
Auth failure / 407Username and password match the console; the shell did not break escaping
Hang or timeoutProtocol and port match the order; you are not using the fake host
Traffic still looks localProxy is set on the correct launch/context; no extra system proxy is interfering
Wrong regionThe order region is correct; DNS is not resolving only on your machine

Limits

Use the samples only against targets you may access. This is not a guide to bypassing logins, CAPTCHAs, fingerprint checks, or platform rules. Prices and inventory follow the console (about $0.40/GB rotating, about $0.20/GB for the 100 TB bundle; shared static about $1.50 and dedicated about $5 per IP·month). USDT/USDC available; Visa/Mastercard applying. Not for mainland China.

FAQ

Can I use the sample hostname as-is?

No. `proxy.example.invalid` is a fake placeholder. Use the host and port the console returns.

How is this different from the antidetect guide?

This page is Playwright code. If you use a product such as AdsPower, see antidetect wiring. They are not the same tutorial.

Does this replace the localization solutions page?

No. Which product to use for language or checkout checks still lives on localization testing. This page only covers how to connect in code.

Do I need SOCKS5?

Only if the console returns SOCKS. Many HTTPS pages work through an HTTP proxy via CONNECT. See HTTP / SOCKS5 setup.

Does a new context keep the same IP?

Not necessarily. Connection reuse is not a static IP and not automatically a sticky session.

May I use this to sign into other people’s accounts?

No. Lawful, authorized targets only.

What changes in Playwright between rotating and static?

The client fields look similar. The difference is the product you bought. Choose the product first, then paste that order’s credentials.

Where are prices confirmed?

In the console. Published list: Pricing.

Next steps

  1. Copy real fields from the console (not the placeholders).
  2. Run the script against an authorized page.
  3. Open rotating or static if you still need to pick a plan.