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 username and password in the proxy launch config, unlike Puppeteer which needs workarounds. This makes KnoxProxy integration straightforward.
Yes. Launch the browser with a default proxy, then override per context with browser.newContext({ proxy: {...} }).
Playwright has native proxy auth support, cross-browser testing, and better auto-waiting. Use Playwright for new projects; Puppeteer if you have an existing codebase.
No. Proxy routing is identical in headed and headless mode. Headless is recommended for server-side automation.
Free trial on rotating residential -- 5 minutes setup, no credit card.