Quick answer
How do I use proxies with Playwright, Puppeteer and Selenium?
Point the browser at http://gw.namelessproxy.com:7777 and log in with your proxy username and password. Nameless Proxy, a privacy-first, no-KYC proxy provider, works with Playwright's proxy option, Puppeteer's page.authenticate() and Selenium through a local forwarder. One session ID per browser context keeps one IP per profile. Residential traffic starts at $0.53/GB. No KYC — no ID, no selfie, no documents. Pay in crypto.
Browser setup at a glance
| Proxy server | http://gw.namelessproxy.com:7777 (HTTP port) |
|---|---|
| Playwright | proxy option with server, username and password, per browser or per context |
| Puppeteer | --proxy-server flag plus page.authenticate() |
| Selenium | Local forwarder that adds the credentials, or an IP whitelist |
| One IP per profile | A session ID per context, for up to 60 minutes |
| Targeting | In the username: USERNAME-country-{cc}-city-{city}-session-{id}-ttl-{minutes} |
Which proxy port do browsers need?
Use the HTTP port, 7777. It carries HTTPS through CONNECT tunnels, which every browser supports. Chromium does not support SOCKS5 with a username and password, so the SOCKS5 port only suits tools that handle SOCKS5 login themselves.
A browser downloads images, fonts and scripts, so it uses far more traffic per page than a plain HTTP client. Block heavy resources you do not need; traffic is billed per decimal GB.
How do I set a proxy in Playwright?
Pass a proxy object with server, username and password. Set it on each browser context to give every context its own country and sticky session in one browser process. Match locale and timezone_id to the exit country so the page sees a consistent visitor.
# pip install playwright && playwright install chromium
import uuid
from playwright.sync_api import sync_playwright
SERVER = "http://gw.namelessproxy.com:7777" # HTTP port: browsers
USERNAME, PASSWORD = "USERNAME", "PASSWORD"
def proxy_for(country, city, ttl=30):
"""One sticky session per browser context."""
session = uuid.uuid4().hex[:10]
return {
"server": SERVER,
"username": f"{USERNAME}-country-{country}-city-{city}-session-{session}-ttl-{ttl}",
"password": PASSWORD,
}
with sync_playwright() as p:
# Placeholder launch proxy: some Chromium builds need one before contexts
# can set their own. It is never used when every context sets a proxy.
browser = p.chromium.launch(proxy={"server": "http://per-context"})
for country, city, tz in [("ae", "dubai", "Asia/Dubai"), ("sa", "riyadh", "Asia/Riyadh")]:
context = browser.new_context(proxy=proxy_for(country, city), locale="ar", timezone_id=tz)
page = context.new_page()
page.goto("https://api.ipify.org")
print(country, page.inner_text("body"))
context.close()
browser.close()// npm i playwright && npx playwright install chromium
const { chromium } = require('playwright');
const crypto = require('crypto');
const server = 'http://gw.namelessproxy.com:7777';
const proxyFor = (country, city, ttl = 30) => ({
server,
username: `USERNAME-country-${country}-city-${city}-session-${crypto.randomBytes(5).toString('hex')}-ttl-${ttl}`,
password: 'PASSWORD',
});
(async () => {
const browser = await chromium.launch({ proxy: { server: 'http://per-context' } });
const context = await browser.newContext({ proxy: proxyFor('eg', 'cairo') });
const page = await context.newPage();
await page.goto('https://api.ipify.org');
console.log(await page.textContent('body'));
await browser.close();
})();How do I set a proxy in Puppeteer?
Launch Chrome with --proxy-server and call page.authenticate() before the first navigation. Chrome ignores credentials written into the flag, so the page answers the proxy's 407 challenge instead. Each page can authenticate with a different username, so each page can have its own country and session. Recent Puppeteer versions also accept a proxyServer option in browser.createBrowserContext().
// npm i puppeteer
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch({
args: ['--proxy-server=http://gw.namelessproxy.com:7777'],
});
const page = await browser.newPage();
// Chrome ignores credentials in --proxy-server, so answer the 407 challenge per page
await page.authenticate({
username: 'USERNAME-country-ng-city-lagos-session-x7k2p9-ttl-30',
password: 'PASSWORD',
});
await page.goto('https://api.ipify.org');
console.log(await page.evaluate(() => document.body.innerText));
await browser.close();
})();How do I use an authenticated proxy with Selenium?
Run a small local forwarder that adds your credentials, and point Chrome at it. Chrome's --proxy-server flag accepts no username or password, and Selenium has no option to fill in the proxy login. The forwarder below uses pproxy: it listens on your machine without a password and forwards to the gateway with your username, targeting included. Run one forwarder per sticky session, each on its own local port.
If your machine has a fixed public IP, you can whitelist it in the client area instead and pass the gateway address straight to --proxy-server. The selenium-wire package also handled proxy login, but it is no longer maintained.
pip install pproxy selenium
# Local forwarder: no auth on 127.0.0.1:8899, adds your credentials upstream (#user:pass)
pproxy -l http://127.0.0.1:8899 \
-r "http://gw.namelessproxy.com:7777#USERNAME-country-ke-city-nairobi-session-k3m9q1-ttl-30:PASSWORD"# Selenium 4.6+ downloads the matching chromedriver itself (Selenium Manager)
from selenium import webdriver
from selenium.webdriver.common.by import By
options = webdriver.ChromeOptions()
options.add_argument("--proxy-server=http://127.0.0.1:8899") # the local forwarder
driver = webdriver.Chrome(options=options)
try:
driver.get("https://api.ipify.org")
print(driver.find_element(By.TAG_NAME, "body").text)
finally:
driver.quit()How do I keep one IP per browser profile?
Give each browser context its own session ID and a TTL, and keep that ID for the life of the profile. The context then exits from the same residential IP while the TTL lasts (for up to 60 minutes). If the device behind the IP goes offline, start a new session ID.
When a profile must keep one IP for days, a dedicated 4G/5G port fits better: the IP stays until you rotate it. Use proxies for legitimate work such as ad verification, QA and managing your clients' accounts. Fake accounts and ban evasion are banned by the Acceptable Use Policy.
Frequently asked questions
Why does Chrome ignore the username and password in --proxy-server?
Chrome's command-line flag only takes a scheme, host and port; it does not read credentials from it. The browser instead waits for the proxy's 407 challenge. Playwright answers it from its proxy option and Puppeteer from page.authenticate(). Selenium has no such hook for proxy login, which is why it needs a local forwarder or an IP whitelist.
Can I use the SOCKS5 port with Playwright or Puppeteer?
Not with a username and password: Chromium does not support SOCKS5 proxy authentication. Use the HTTP port, 7777, which carries HTTPS through CONNECT tunnels and supports login. The SOCKS5 port, 7778, is for tools that handle SOCKS5 authentication themselves, such as curl or Python with socks5h://.
How do I give each browser context a different country?
Build the proxy username per context: USERNAME-country-ae-city-dubai-session-… for one context and USERNAME-country-sa-city-riyadh-session-… for another. In Playwright, pass it in new_context(proxy=…). In Puppeteer, open one page per country and call page.authenticate() with each username. One browser process can serve many countries this way.
How do I cut the traffic a headless browser uses?
Block what you do not need. In Playwright, page.route() can abort requests for images, fonts and media; in Puppeteer, use request interception. Reuse one context for several pages of the same site so the cache works. Traffic is billed per decimal GB, and the client area shows daily usage, so measure before and after.
Why does a site still show the wrong country?
The IP is only one signal. Sites also read the browser language, the time zone and sometimes the Geolocation API. Set locale and timezone_id on the Playwright context to match the exit country, for example Asia/Dubai for the UAE. Also clear cookies that a site set during an earlier visit from another country.
Is selenium-wire still a good way to add a proxy login?
It worked, but the project is no longer maintained, so it may break with new Chrome or Selenium versions. A local forwarder such as pproxy does one job, adding credentials to an upstream proxy, and works with any browser. Whitelisting your server's IP in the client area removes the need for credentials altogether.
Give every browser profile its own IP
Residential proxies from $0.53/GB, dedicated 4G/5G ports from $2.63/day. No KYC — no ID, no selfie, no documents.