Sous proxy / Integrations / Playwright

Proxy in Playwright: Python and Node.js

In Playwright a proxy with a password is one object in launch. Below is Python code and the same thing in Node.js.

HTTPHTTPSSOCKS5Login and passwordRotation and sticky
Playwright · proxy
http://HOST:PORT
LOGIN
••••••
localhost
✓ IP: Germany, residentialRun

Why use a proxy in Playwright

Playwright drives Chromium, Firefox and WebKit from Python, Node.js, Java and .NET. Its launch method has a proxy option with server, username, password and bypass fields. A proxy can also be set per context via new_context.

What to pick

Take HTTP: Playwright accepts login and password only for HTTP(S) proxies and throws an error on socks5 with auth. Rotation suits data collection; a sticky session suits one context living on one IP.

Residential

from $0.6 / GB

Home ISP addresses. The main choice for accounts and protected sites.

VIP

$2 / GB

Hand-picked clean IPs, faster and more stable than regular residential.

Mobile

$4 / GB

Carrier IPs, for platforms that check addresses strictly.

Step-by-step setup

Button names are given exactly as they appear in Playwright.

  1. Install Playwright

    Python: pip install playwright and playwright install chromium. Node.js: npm i playwright and npx playwright install chromium.

  2. Export the proxy

    Choose HTTP in @SousProxyBot or the dashboard. Host and port go into server, login and password into separate fields.

  3. Pass proxy to launch

    Pass proxy={"server": "http://HOST:PORT", "username": "LOGIN", "password": "PASSWORD"} to chromium.launch. In Node.js it's the same object: proxy: { server, username, password }.

  4. Run the script

    Python: python ip.py. Node.js: node ip.mjs with const browser = await chromium.launch({ proxy: { server: 'http://HOST:PORT', username: 'LOGIN', password: 'PASSWORD' } }).

  5. Check the IP

    The script opens https://api.ipify.org?format=json and prints the address. It must match the proxy IP; compare the country in /en/tools/ip-type/.

Code example

Put in your own HOST, PORT, LOGIN and PASSWORD from the bot or the dashboard.

python
from playwright.sync_api import sync_playwright

with sync_playwright() as p:
    browser = p.chromium.launch(proxy={
        "server": "http://HOST:PORT",
        "username": "LOGIN",
        "password": "PASSWORD",
    })
    page = browser.new_page()
    page.goto("https://api.ipify.org?format=json")
    print(page.inner_text("body"))
    browser.close()

Tested by running it

We ran this example ourselves: Python 3.13.18 · playwright 1.63.0 · Chrome for Testing 153.0.8010.12. Real output below, IP hidden.

Terminal · ip.py
$ python ip.py
{"ip":"proxy IP"}

And this is the response when the password is wrong:

$ python ip.py
raise rewrite_error(error, f"{parsed_st['apiName']}: {error}") from None
playwright._impl._errors.TimeoutError: Page.goto: Timeout 30000ms exceeded.
Call log:
  - navigating to "https://api.ipify.org/?format=json", waiting until "load"

Common errors

The issues people most often bring to support.

!

Browser does not support socks5 proxy authenticationPlaywright doesn't pass login and password for socks5. Export the proxy as HTTP and set server: http://HOST:PORT.

!

407 Proxy Authentication RequiredLogin and password must be in the username and password fields. Make sure there are no extra spaces.

!

Executable doesn't exist at launchThe browser isn't downloaded. Run playwright install chromium (in Node.js, npx playwright install chromium).

!

The local server also goes through the proxyAdd it to bypass, e.g. "localhost, 127.0.0.1".

Need a proxy for Playwright?

Residential, VIP and mobile IPs. HTTP and SOCKS5, pay per GB, 1 GB free to try.

FAQ

Can different contexts use different proxies?

Yes, browser.new_context has a proxy option too. One browser can then hold several contexts on different IPs.

What does the Node.js example look like?

import { chromium } from 'playwright'; then chromium.launch({ proxy: { server: 'http://HOST:PORT', username: 'LOGIN', password: 'PASSWORD' } }), page.goto and page.innerText('body'). Same logic as Python.

Is SOCKS5 supported?

Without auth, yes: server: socks5://HOST:PORT. With login and password Playwright doesn't accept SOCKS5, so take HTTP.