PacketStream integration
Using PacketStream residential proxies with Playwright
Copy a Playwright launch for PacketStream's authenticated HTTPS proxy, verify the residential exit, and add targeting or sessions.
Run client-rendered checks through a residential exit by adding PacketStream to Playwright’s browser launch. Every page in that browser instance uses the same proxy configuration.
Configure
Install Playwright and set the credentials:
npm install playwright
npx playwright install chromium
export PACKETSTREAM_USER='your_username'
export PACKETSTREAM_AUTH_KEY='your_auth_key'
Create packetstream_playwright.mjs:
import { chromium } from "playwright";
const browser = await chromium.launch({
proxy: {
server: "https://proxy.packetstream.io:31111",
username: process.env.PACKETSTREAM_USER,
password: process.env.PACKETSTREAM_AUTH_KEY,
},
});
try {
const page = await browser.newPage();
await page.goto("https://ipinfo.io/json", {
waitUntil: "domcontentloaded",
timeout: 30_000,
});
console.log(JSON.parse(await page.locator("body").innerText()));
} finally {
await browser.close();
}
This setup uses Playwright’s documented HTTP(S) proxy configuration with PacketStream’s HTTPS endpoint.
Verify your exit
Run node packetstream_playwright.mjs and inspect the parsed ipinfo.io response for the observed ip and country before navigating to the intended page.
Country targeting and sticky sessions
Change the password in the launch configuration:
password: `${process.env.PACKETSTREAM_AUTH_KEY}_country-US_session-browser42`,
Launch separate browser instances when concurrent workflows need different session labels.
Troubleshooting
- Confirm both environment variables exist before launch. An undefined password produces an authentication failure.
- Keep
https://on the proxy server value and port31111on the endpoint. - Browsers reuse connections. A new page or navigation does not guarantee a new proxy connection or exit.
See proxy troubleshooting for browser timeouts, authentication, TLS, and session recovery.