Use ProxyHQ with Playwright
Run Playwright browsers through ProxyHQ in Node.js or Python.
Connection details
Use these values. Your login and password are in your dashboard.
| Type | HTTP (or SOCKS5) |
| Host | gw.proxyhq.net |
| Port (HTTP / HTTPS) | 823 |
| Port (SOCKS5) | 824 |
| Sticky ports | 10000 - 20000 |
| Username | YOUR_LOGIN |
| Password | YOUR_PASSWORD |
Steps
- Install Playwright and its browsers.
- Pass a proxy object when you launch the browser with the server, username and password.
- Open an IP-check page to confirm it works.
import { chromium } from "playwright";
const browser = await chromium.launch({
proxy: {
server: "http://gw.proxyhq.net:823",
username: "YOUR_LOGIN__cr.us",
password: "YOUR_PASSWORD",
},
});
const page = await browser.newPage();
await page.goto("https://api.ipify.org");
console.log(await page.textContent("body"));
await browser.close();from playwright.sync_api import sync_playwright
with sync_playwright() as p:
browser = p.chromium.launch(proxy={
"server": "http://gw.proxyhq.net:823",
"username": "YOUR_LOGIN__cr.us",
"password": "YOUR_PASSWORD",
})
page = browser.new_page()
page.goto("https://api.ipify.org")
print(page.text_content("body"))
browser.close()To use a different proxy per context, set the proxy in browser.new_context instead.
Choose a country or a sticky IP
Add __cr.de (or another country code) to the end of your login to choose a country. Use a port from 10000 to 20000 for a sticky IP. See country targeting and rotating vs sticky.
Stuck? See troubleshooting or email [email protected].