Setup guide
Playwright proxy setup for Python and Node
Playwright takes the proxy when the browser launches, with the username and password in fields of their own. The option names are the same in Python and Node, so both versions are here.
Before you start
- Playwright for Python (pip install playwright) or for Node (npm i playwright).
- A browser downloaded with playwright install chromium.
- Your service’s HOST, PORT, USERNAME and PASSWORD.
Your connection details
Sign in to the dashboard and open the service you bought. Its page shows the host, port, username and password for that service. There is no single ProxyPanda address to remember, so copy them from there each time. The code in these guides uses the placeholders below; replace each one with your own value.
- HOST
- The proxy address for this service, exactly as the service page shows it.
- PORT
- The port to connect to. Copy it with the host, since it can differ from one service to the next.
- USERNAME
- Your proxy login. It is separate from the email you use for the dashboard.
- PASSWORD
- Copy it in full. On residential, the options you choose in the dashboard are added to the end of the password, so a password typed from memory loses them.
You can skip the username and password by adding the IP address you connect from to the service’s allowlist. Then only HOST and PORT go into your code.
The examples use HTTP, which reaches https sites through an encrypted tunnel. SOCKS5 works too: residential ports accept both, and ISP and datacenter proxies switch protocol in the dashboard.
Steps
Pass proxy to launch() in Python
server holds the scheme, host and port only. username and password sit in their own keys, and Playwright answers the proxy’s login challenge with them.
check_ip.py from playwright.sync_api import sync_playwright with sync_playwright() as p: browser = p.chromium.launch( proxy={"server": "http://HOST:PORT", "username": "USERNAME", "password": "PASSWORD"} ) page = browser.new_page() page.goto("https://api.ipify.org?format=json") print(page.inner_text("body")) browser.close()The same launch in Node
The Node API uses identical option names. Save the file with an .mjs extension so top-level await works, and run it with node.
check-ip.mjs import { chromium } from 'playwright'; const browser = await chromium.launch({ proxy: { server: 'http://HOST:PORT', username: 'USERNAME', password: 'PASSWORD' }, }); const page = await browser.newPage(); await page.goto('https://api.ipify.org?format=json'); console.log(await page.textContent('body')); await browser.close();Give each context its own proxy
A proxy can also be set per context, with new_context(proxy=...) in Python or newContext({ proxy }) in Node. One browser can then run several profiles, each through its own credentials.
contexts.py context = browser.new_context( proxy={"server": "http://HOST:PORT", "username": "USERNAME", "password": "PASSWORD"} ) page = context.new_page()Block images, media and fonts
A page pulls in far more than its HTML. On residential every byte counts toward the bill, so abort the resource types your script never looks at.
block_media.py page.route( "**/*", lambda route: route.abort() if route.request.resource_type in ("image", "media", "font") else route.continue_(), )
Rotating and sticky IPs
A browser opens several connections to load one page. With Randomize IP on residential, each new connection can leave from a different address, so a site may see one visit arrive from several places. For browsing that should look like one visitor, choose Sticky IP.
ISP and datacenter IPs keep one address for the whole term, which suits a logged-in context you come back to day after day.
Common errors and fixes
Page.goto: Timeout exceeded, with no 407 in sight
With a wrong username or password, Chromium keeps retrying the proxy login and the navigation times out instead of reporting a 407. Check the credentials before you raise the timeout.
net::ERR_PROXY_CONNECTION_FAILED
Nothing answered at HOST:PORT. Compare both with the service page and check that the service is still active.
net::ERR_TUNNEL_CONNECTION_FAILED
The proxy was reached but could not open a tunnel to the site. Retry once. If it keeps happening for one site only, bring the URL to Discord.
The page works in your own browser but not under Playwright
Headless Chromium names itself HeadlessChrome in its user agent. Set a normal one with new_context(user_agent=...) in Python or userAgent in Node, or launch headed for sites that check.
Which line to pick
Browser automation moves a lot more data than plain HTTP calls. If the site does not block servers, datacenter IPs keep that cheap. For sites that check the network, use residential with Sticky IP, or ISP when the same profile logs in every day.
Other setup guides
Not sure what a word means? The glossary explains it in plain English.
Stuck on a step?
Paste the command and the error into Discord, with your password taken out. People there have met most of these errors before.