Tutorials7 min read

Playwright Proxy Setup: Complete Tutorial

How to configure proxies in Playwright for browser automation with Python, Node.js, and TypeScript.

OutreachProxy Team

Proxy Experts

Playwright Proxy Configuration

Set up proxies in Playwright for cross-browser automation.

TL;DR: Pass proxy option to browser.launch() or browser.newContext(). Supports HTTP, HTTPS, and SOCKS proxies.

Python Setup

from playwright.sync_api import sync_playwright

with sync_playwright() as p: browser = p.chromium.launch( proxy={ "server": "http://proxy.outreachproxy.com:8080", "username": "your_username", "password": "your_password" } ) page = browser.new_page() page.goto("https://httpbin.org/ip") print(page.content()) browser.close()

Node.js Setup

const { chromium } = require('playwright');

(async () => { const browser = await chromium.launch({ proxy: { server: 'http://proxy.outreachproxy.com:8080', username: 'your_username', password: 'your_password' } }); const page = await browser.newPage(); await page.goto('https://httpbin.org/ip'); console.log(await page.content()); await browser.close(); })();

Per-Context Proxy

const browser = await chromium.launch();
const context = await browser.newContext({
    proxy: {
        server: 'http://proxy:port',
        username: 'user',
        password: 'pass'
    }
});
const page = await context.newPage();

SOCKS5 Proxy

const browser = await chromium.launch({
    proxy: {
        server: 'socks5://proxy.outreachproxy.com:1080'
    }
});

Bypass for Specific Hosts

proxy: {
    server: 'http://proxy:port',
    bypass: 'localhost,*.internal.com'
}
Playwrightautomationbrowser

Written by OutreachProxy Team

Proxy Experts

The OutreachProxy team helps businesses scale their cold outreach with reliable static residential proxies. We share our expertise to help you succeed.

Ready to Scale Your Outreach?

Get started with static residential proxies built for cold outreach professionals. From $2.97/month with unlimited bandwidth.

Get Started