Code / Playwright
How to Use Proxies with Playwright
Apply an authenticated HTTP proxy when launching Chromium with Playwright. Choose Python or Node.js below, replace the connection placeholders, and run the example to check the browser's outgoing IP.
Last checked:
Before you start
Get your proxy details from Dashboard → Proxies. You'll need the host, port, username and password.
Replace HOST, PORT, USERNAME and PASSWORD in the examples with your own details. Use the port that matches your connection type.
Code examples
Python
Install dependencies
pip install playwright
playwright install chromiumfrom 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()Check it worked
Run the example above to open https://api.ipify.org?format=json through the proxy. The IP shown should be your proxy's IP, not your own.
Read the IP printed by the script, rather than opening the link in an unconfigured browser. A rotating proxy's IP can change between requests.
Troubleshooting
- 407 Proxy Authentication Required
- Username or password is wrong; copy them again from the dashboard.
- Connection timed out / refused
- Check host and port, and that the proxy is Active (not expired) in the dashboard.
- IP shows my own address
- The proxy isn't applied; re-check the settings and restart the browser profile or script.
- Wrong country
- Check which location you bought in the dashboard.
Still stuck? Open a support ticket — include your order ID.
Frequently asked questions
Related guides
Need a proxy for this?
Static residential proxies work best for account management; rotating residential for scraping.