Prepare the client
Install Playwright with npm install playwright and install its browser with npx playwright install chromium. Use private environment variables for connection details.
Connection example
Playwright proxy example
import { chromium } from 'playwright';
const { PROXY_SERVER, PROXY_USERNAME, PROXY_PASSWORD } = process.env;
if (!PROXY_SERVER || !PROXY_USERNAME || !PROXY_PASSWORD) {
throw new Error('Set the three proxy environment variables first.');
}
const browser = await chromium.launch({
proxy: {
server: PROXY_SERVER, // HTTP(S) proxy URL without credentials
username: PROXY_USERNAME,
password: PROXY_PASSWORD,
},
});
try {
const page = await browser.newPage();
const response = await page.goto('https://example.com/', {
waitUntil: 'domcontentloaded',
timeout: 30000,
});
console.log(response?.status(), await page.title());
} finally {
await browser.close();
}Verify the connection
Start with a public test destination you are allowed to access. Confirm authentication, exit IP and timeouts before adding target-specific parsing. Never disable TLS verification to make a failing connection appear successful.
When it fails
Review Troubleshooting for authentication, DNS, connection and TLS errors. Include your client version and a sanitized error when contacting support.