Modern browser automation by Microsoft. Playwright has built-in proxy support with authentication, making KnoxProxy setup trivial.
Install and set up browsers.
npm install playwright
npx playwright install chromiumPass proxy config to browser launch.
const browser = await chromium.launch({
proxy: {
server: 'http://gw.knoxproxy.com:7000',
username: 'USER',
password: 'PASS',
},
});Browse through the proxy.
const page = await browser.newPage();
await page.goto('https://httpbin.org/ip');
console.log(await page.textContent('pre'));Add country to username.
proxy: { server: 'http://gw.knoxproxy.com:7000', username: 'USER-country-jp', password: 'PASS' }Different proxy per browser context.
const context = await browser.newContext({
proxy: { server: 'http://gw.knoxproxy.com:7000', username: 'USER-country-de', password: 'PASS' },
});Verify exit IP.
await page.goto('https://httpbin.org/ip');/**
* KnoxProxy + Playwright -- multi-geo browser automation.
*/
import { chromium } from 'playwright';
const browser = await chromium.launch({
proxy: {
server: 'http://gw.knoxproxy.com:7000',
username: 'USER',
password: 'PASS',
},
});
const page = await browser.newPage();
await page.goto('https://httpbin.org/ip');
const ip = await page.textContent('pre');
console.log('Exit IP:', ip);
// Country-targeted context
const deContext = await browser.newContext({
proxy: {
server: 'http://gw.knoxproxy.com:7000',
username: 'USER-country-de',
password: 'PASS',
},
});
const dePage = await deContext.newPage();
await dePage.goto('https://httpbin.org/ip');
console.log('DE IP:', await dePage.textContent('pre'));
await browser.close();Create new browser contexts for different IPs. Each context with a unique -session-{id} username gets a sticky IP. New context without session = new IP.
| Problem | Fix |
|---|---|
| net::ERR_PROXY_CONNECTION_FAILED | Verify server, username, password in proxy config. Check port 7000 is open. |
| Page timeout | Increase page.goto timeout. Switch to residential if using datacenter. |
| Browser launch fails | Run npx playwright install chromium. |
USER-country-de-city-berlin-session-profile07Order matters -- geo flags before the session flag. The session name is free text; use the profile ID so the mapping is self-documenting. Password stays as issued; no flags belong there. HTTP on :7000, SOCKS5 on :7001, same credentials.
Yes. Playwright accepts a username and password directly in its proxy launch configuration, unlike Puppeteer, which needs a separate page.authenticate() call for every new page. This built-in support makes wiring up KnoxProxy straightforward: pass server, username, and password once at browser launch, and every page and context inherits that authentication automatically.
Yes. Launch the browser once with a default KnoxProxy proxy configuration, then override it for individual browser contexts by passing a different proxy object to browser.newContext({ proxy: {...} }). Each context keeps its own proxy setting independently, so one Playwright process can run multiple countries or identities side by side in parallel.
For new projects, choose Playwright: it has native proxy authentication support, cross-browser testing built in, and better auto-waiting logic that reduces flaky scrapes. Puppeteer remains a solid choice if you already have an existing codebase built on it, and KnoxProxy works fine with both through their respective proxy configuration options.
No. Proxy routing through KnoxProxy is identical whether Playwright launches in headed or headless mode, since the proxy configuration lives at the browser or context level, not in the rendering mode. Headless mode is the recommended choice for server-side automation, and switching between headed and headless needs no changes to your proxy setup at all.
Rotating residential proxies -- 5 minutes setup, instant activation, 14-day money-back guarantee.