Playwright

How to Use SocksNode Residential Proxies with Playwright

Quick answer

To use SocksNode residential proxies with Playwright, pass a proxy object to browserType.launch() with server set to http://global.socksnode.com:9000 and your generated username and password. Add -country tokens to the username for geo targeting, and use port 10000 with a session token to keep one IP across a browser context.

Before you start

SocksNode offers residential proxies in 195+ countries over HTTP, HTTPS, and SOCKS5 with username/password auth. Generate credentials in the dashboard proxy generator; that step is free and only routed traffic uses your prepaid bandwidth (from 5 GB for $4.50, non-expiring on flexible plans).

Playwright accepts proxy credentials directly in the launch options, so no separate authentication event handler is needed.

Node.js 18+ with @playwright/test or playwright installed
Browsers installed via npx playwright install
A SocksNode account with prepaid bandwidth
A username/password from /dashboard/generator
The country token for your target region

Configure the proxy in Playwright

Set the proxy on the launch call:

You can also scope proxies per context with browser.newContext({ proxy: {...} }), which lets one browser run several geo profiles side by side just by changing the username token.

import { chromium } from 'playwright';

const browser = await chromium.launch({
  proxy: {
    server: 'http://global.socksnode.com:9000',
    username: 'USERNAME-country-us',
    password: 'PASSWORD',
  },
});
const page = await browser.newPage();
await page.goto('https://api.ipify.org');

Rotating vs sticky sessions

Rotating sessions give a new residential IP per request on HTTP port 9000, ideal for high-volume, distributed crawling.

Sticky sessions pin one IP from 1 minute to 24 hours on HTTP port 10000. Use a token like USERNAME-country-us-session-shop1-lifetime-60 to keep the same IP for a 60-minute session. Playwright supports authenticated HTTP proxies, so prefer the HTTP ports when you need username/password auth.

Geo targeting with username tokens

Targeting lives in the username: country for 195+ countries, US state and city, or ASN/ISP within a country. Change only the username to move exits between regions without touching your code paths.

Collect data responsibly, honor site terms of service, and respect applicable laws and reasonable request rates.

See also

Frequently asked questions

Can I set a different proxy per browser context?

Yes. Pass a proxy object to browser.newContext(), changing the username token per context to run multiple countries or sticky sessions in one browser.

Which ports work with Playwright?

Use HTTP 9000 (rotating) or 10000 (sticky). Authenticated SOCKS5 is not reliable in Chromium, so the HTTP ports are recommended when using username/password auth.

How do I keep one IP for a whole flow?

Use port 10000 and add a session and lifetime token, for example USERNAME-country-us-session-abc-lifetime-30, to hold the IP for up to 24 hours.

How do I target a country?

Append the country token to your username, such as USERNAME-country-de for Germany. SocksNode covers 195+ countries plus US state, city, and ASN targeting.

Do unused credentials expire?

Credentials do not expire and are free to generate. On flexible prepaid plans your bandwidth balance is non-expiring; only traffic consumes it.

Related posts

All posts

Get started.

Create an account, generate a credential, connect. The API is the same one the dashboard uses.