Integration
How to Use Proxies With Playwright
Playwright accepts proxy settings when launching a browser. Supply the endpoint as server and pass username and password separately. Keep this configuration in server-side automation code, never in JavaScript delivered to website visitors.
Launch Chromium through the proxy
Copy the HTTP(S) host and port from the dashboard. The example checks the observed exit IP and then closes the browser cleanly.
import { chromium } from "playwright";
const browser = await chromium.launch({
proxy: {
server: process.env.PROXY_SERVER,
username: process.env.PROXY_USERNAME,
password: process.env.PROXY_PASSWORD,
},
});
const page = await browser.newPage();
await page.goto("https://ipinfo.io/json", { waitUntil: "domcontentloaded" });
console.log(await page.textContent("body"));
await browser.close();Choose rotation before launch
Use the dashboard generator to create the password configuration. For a sticky browser journey, keep the same generated password for that browser context. For independent checks, use separate generated lines or rotating mode.
Control page weight
A real browser loads more than HTML. Fonts, images, scripts, and media all contribute to proxy bandwidth. If a legitimate test does not require heavy asset types, block them explicitly and confirm that doing so does not change the behavior being measured.
await page.route("**/*", async (route) => {
const type = route.request().resourceType();
if (["image", "media", "font"].includes(type)) {
await route.abort();
} else {
await route.continue();
}
});Debug in layers
First test the same credentials with cURL. If cURL works, verify the Playwright endpoint syntax and environment variables. If the route works but the destination rejects it, that is a destination response rather than a proxy authentication failure.
