Skip to content

Playwright

Basic Usage

import { chromium } from 'playwright';
const browser = await chromium.launch({
proxy: {
server: 'http://connect.trueproxies.com:8080',
username: 'your_username',
password: 'your_password',
},
});
const page = await browser.newPage();
await page.goto('https://httpbin.org/ip');
console.log(await page.textContent('body'));
await browser.close();

SOCKS5

const browser = await chromium.launch({
proxy: {
server: 'socks5://connect.trueproxies.com:1080',
username: 'your_username',
password: 'your_password',
},
});

Country Targeting

const browser = await chromium.launch({
proxy: {
server: 'http://connect.trueproxies.com:8080',
username: 'your_username-country-us',
password: 'your_password',
},
});

Per-Context Proxies

Use different proxies per browser context:

const browser = await chromium.launch();
const context = await browser.newContext({
proxy: {
server: 'http://connect.trueproxies.com:8080',
username: 'your_username-country-de',
password: 'your_password',
},
});
const page = await context.newPage();
await page.goto('https://httpbin.org/ip');
console.log(await page.textContent('body'));
await context.close();
await browser.close();

Python

from playwright.sync_api import sync_playwright
with sync_playwright() as p:
browser = p.chromium.launch(proxy={
"server": "http://connect.trueproxies.com:8080",
"username": "your_username",
"password": "your_password",
})
page = browser.new_page()
page.goto("https://httpbin.org/ip")
print(page.text_content("body"))
browser.close()