Hype Proxies

How to use a proxy with Playwright

This guide shows you how to integrate HypeProxies with Playwright to handle IP restrictions, geo-targeting challenges, and rate limiting in your web scraping workflows.

Speed

Success

Consistency

Reliability

Flexibility

What is Playwright

Playwright is a framework for browser automation and end-to-end testing. It supports all major browsers (Chromium, Firefox, WebKit) and multiple programming languages (JavaScript/TypeScript, Python, C#, Java). Playwright makes it easy to simulate user interactions across browsers, making it ideal for web data extraction and automation.

Playwright homepage

At scale – crawling thousands of pages or running bulk automation – sites enforce IP blocks, geo restrictions, and rate limits. Proxies mitigate these challenges by routing requests through different IPs and locations, which minimizes the risk of blocks and helps maintain reliable access.

Get your HypeProxies credentials

HypeProxies runs on 10 Gbps+ servers with sub-1 ms latency and a 99.9% uptime SLA.

Follow these steps to access your proxy credentials:

Step 1 – log in (or create an account).

New users can also request a 24-hour trial.

Step 2 – choose a proxy plan.

Select the plan that best suits your use case – for example, ISP proxies or specialized options, such as Sneaker or Ticket proxies.

Step 3 – check your dashboard.

Your active proxies are listed in the format: IP:PORT:USERNAME:PASSWORD

HypeProxies dashboard

(Optional): Test your proxy connectivity using our online proxy checker tool – this will verify that your proxy is working and show its network details (location, speed, anonymity, etc.).

Next, we'll configure Playwright to use HypeProxies proxies in both Node.js and Python.

Method 1 – global proxy (browser-wide)

Launch the browser with a proxy so every page in that instance uses the same IP – ideal when you want a single endpoint for the whole session.

Node.js (TypeScript):

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

(async () => {
  const browser = await chromium.launch({
    proxy: {
      server: "http://<PROXY_SERVER_IP>:<PROXY_PORT>", // your proxy IP and port
      username: "<PROXY_USERNAME>", // your HypeProxies username
      password: "<PROXY_PASSWORD>", // your HypeProxies password
    },
  });
  const page = await browser.newPage();
  await page.goto("https://ipapi.co/json/"); // returns your current IP address
  const body = await page.textContent("body");
  console.log(body);
  await browser.close();
})();

Running the script prints the proxy's IP details in JSON, like this:

Output

Python:

from playwright.sync_api import sync_playwright

with sync_playwright() as p:
    browser = p.chromium.launch(
        proxy={
            "server": "http://<PROXY_SERVER_IP>:<PROXY_PORT>",
            "username": "<PROXY_USERNAME>",
            "password": "<PROXY_PASSWORD>",
        }
    )
    page = browser.new_page()
    page.goto("https://ipapi.co/json/")
    content = page.content()
    print(content)
    browser.close()

Note – a browser-level proxy applies to every context and page created from that browser.

Troubleshooting – If you hit timeouts or connection failures, first test with our proxy checker to confirm it's reachable. Then verify your username and password, use the protocol your plan supports, and make sure the target site is up. If your plan or IP is suspended or expired, replace it or contact support.

Method 2 – proxy per browser context (multiple proxies in one script)

When you need different proxies within a single Playwright run – e.g., scraping 2 sites in parallel or testing geo-specific behavior – create separate browser contexts and pass a different proxy to each one. Every context is isolated (cookies/storage) and runs inside the same browser process, which is usually more efficient than launching multiple browsers. Set the proxy at context creation; switch proxies by creating a new context.

Node.js (TypeScript):

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

(async () => {
  const browser = await chromium.launch(); // no global proxy

  // Configure proxy for all pages in this context
  const context = await browser.newContext({
    proxy: {
      server: "http://<PROXY_SERVER_IP>:<PROXY_PORT>",
      username: "<PROXY_USERNAME>",
      password: "<PROXY_PASSWORD>",
    },
  });

  const page = await context.newPage();
  await page.goto("https://ipapi.co/json/");
  const content = await page.textContent("body");
  console.log(content);
  await context.close();
  browser.close();
})();

Python:
from playwright.sync_api import sync_playwright

with sync_playwright() as p:
    browser = p.chromium.launch()
    # Configure browser context with proxy settings
    context = browser.new_context(
        proxy={
            "server": "http://<PROXY_SERVER_IP>:<PROXY_PORT>",
            "username": "<PROXY_USERNAME>",
            "password": "<PROXY_PASSWORD>",
        }
    )
    page = context.new_page()
    page.goto("https://ipapi.co/json/")
    content = page.content()
    print(content)
    context.close()
    browser.close()

Note – only pages created inside that context use the assigned proxy. Other contexts (or the base browser) remain unaffected.

With HypeProxies, you can provision proxies from many locations and use them simultaneously, supported by unlimited concurrency.

Method 3 – rotating proxies in Playwright (for web scraping)

For large-scale scraping or long-running crawls, rotating through a pool of proxies helps distribute requests across IPs and reduce block risk. Playwright doesn't rotate automatically, but you can manage this by creating new contexts with different proxies.

2 common strategies:

  • Sequential or random per context – maintain a proxy list and pick 1 each time you create a context or page.

  • Parallel contexts – run multiple contexts concurrently, each with its own proxy, and distribute tasks among them as shown in Method 2.

Here's an example in Python that uses a list of proxies and picks a random proxy for each new context. This simulates rotating IPs for each task or request:

import random
from playwright.sync_api import sync_playwright, ProxySettings

# List of proxies to rotate through
proxy_pool: list[ProxySettings] = [
    {
        "server": "http://<PROXY_SERVER_IP>:<PROXY_PORT>",
        "username": "<PROXY_USERNAME>",
        "password": "<PROXY_PASSWORD>",
    },
    {
        "server": "http://<PROXY_SERVER_IP>:<PROXY_PORT>",
        "username": "<PROXY_USERNAME>",
        "password": "<PROXY_PASSWORD>",
    },
]

with sync_playwright() as p:
    browser = p.chromium.launch()
    for i in range(3):
        proxy_conf = random.choice(proxy_pool)
        context = browser.new_context(proxy=proxy_conf)
        page = context.new_page()
        # returns your current IP address in JSON format
        page.goto("https://httpbin.org/ip")
        print(f"Request {i+1} IP result:", page.text_content("body"))
        # Close context to reset proxy for next iteration
        context.close()
    browser.close()

The output for each request will show a different IP address originating from whichever proxy was chosen. For example, the console output might look like:
Request 1 IP result: { "origin": "123.45.67.89" }
Request 2 IP result: { "origin": "11.22.33.44" }
Request 3 IP result: { "origin": "98.76.54.32" }

Node.js (TypeScript):

import { chromium } from "playwright";

const proxyPool = [
  {
    server: "http://<PROXY_SERVER_IP>:<PROXY_PORT>",
    username: "<PROXY_USERNAME>",
    password: "<PROXY_PASSWORD>",
  },
  {
    server: "http://<PROXY_SERVER_IP>:<PROXY_PORT>",
    username: "<PROXY_USERNAME>",
    password: "<PROXY_PASSWORD>",
  },
];

(async () => {
  const browser = await chromium.launch();

  for (let i = 0; i < 3; i++) {
    const proxyConf = proxyPool[Math.floor(Math.random() * proxyPool.length)];
    const context = await browser.newContext({ proxy: proxyConf });
    const page = await context.newPage();
    await page.goto("https://httpbin.org/ip");
    const result = await page.textContent("body");
    console.log(`Request ${i + 1} IP result:`, result);
    await context.close();
  }

  await browser.close();
})();

Notes


  • You can rotate sequentially, randomly, or drop proxies that appear banned or slow.

  • Rotating on every page load may be overkill; reuse a proxy for a batch of requests, then switch.

  • Creating a new context for each request has overhead – balance frequency of rotation with performance needs.

With HypeProxies, you gain access to a large pool of static proxy IPs and retain full control over rotation by implementing it in your own logic.

Support resources


Start building with stable, high-performance proxies today!

Share on

Stay in the loop

Subscribe to our newsletter for the latest updates, product news, and more.

No spam. Unsubscribe at anytime.

What our clients are saying

What our clients are saying

What our clients are saying

Fast static residential IPs

Proxy plans

Quarterly

10% Off

Monthly

Best value

Starter

Perfect for testing and low-scale usage

$1.40

/ IP

$1.24

/ IP

$35

/month

$31

/month

Quarterly

Cancel at anytime

Pro

Balanced option for daily proxy needs

$1.30

/ IP

$1.16

/ IP

$65

/month

$58

/month

Quarterly

Cancel at anytime

Business

Built for scale and growing demand

$1.25

/ IP

$1.12

/ IP

$125

/month

$112

/month

Quarterly

Cancel at anytime

Enterprise

High-volume power for heavy users

$1.18

/ IP

$1.06

/ IP

$300

/month

$270

/month

Quarterly

Cancel at anytime

Proxies

Bandwidth

Threads

Speed

Support

25 IPs

Unlimited

Unlimited

10GBPS

Standard

50 IPs

Unlimited

Unlimited

10GBPS

Standard

100 IPs

Unlimited

Unlimited

10GBPS

Priority

254 IPs

Subnet

/24 private subnet
on dedicated servers

Unlimited

Unlimited

10GBPS

Dedicated

Crypto

Quarterly

10% Off

Monthly

Starter

Perfect for testing and low-scale usage

$1.40

/ IP

$1.24

/ IP

$35

/month

$31

/month

Quarterly

Cancel at anytime

Get discount below

Proxies

25 IPs

Bandwidth

Unlimited

Threads

Unlimited

Speed

10GBPS

Support

Standard

Pro

Balanced option for daily proxy needs

$1.30

/ IP

$1.16

/ IP

$65

/month

$58

/month

Quarterly

Cancel at anytime

Get discount below

Proxies

50 IPs

Bandwidth

Unlimited

Threads

Unlimited

Speed

10GBPS

Support

Standard

Popular

Business

Built for scale and growing demand

$1.25

/ IP

$1.12

/ IP

$125

/month

$112

/month

Quarterly

Cancel at anytime

Get discount below

Proxies

100 IPs

Bandwidth

Unlimited

Threads

Unlimited

Speed

10GBPS

Support

Priority

Enterprise

High-volume power for heavy users

$1.18

/ IP

$1.06

/ IP

$300

/month

$270

/month

Quarterly

Cancel at anytime

Get discount below

Proxies

254 IPs

Subnet

/24 private subnet
on dedicated servers

Bandwidth

Unlimited

Threads

Unlimited

Speed

10GBPS

Support

Dedicated

Crypto

Quarterly

10% Off

Monthly

Starter

Perfect for testing and low-scale usage

$1.40

/ IP

$1.24

/ IP

$35

/month

$31

/month

Quarterly

Cancel at anytime

Get discount below

Proxies

25 IPs

Bandwidth

Unlimited

Threads

Unlimited

Speed

10GBPS

Support

Standard

Pro

Balanced option for daily proxy needs

$1.30

/ IP

$1.16

/ IP

$65

/month

$58

/month

Quarterly

Cancel at anytime

Get discount below

Proxies

50 IPs

Bandwidth

Unlimited

Threads

Unlimited

Speed

10GBPS

Support

Standard

Popular

Business

Built for scale and growing demand

$1.25

/ IP

$1.12

/ IP

$125

/month

$112

/month

Quarterly

Cancel at anytime

Get discount below

Proxies

100 IPs

Bandwidth

Unlimited

Threads

Unlimited

Speed

10GBPS

Support

Priority

Enterprise

High-volume power for heavy users

$1.18

/ IP

$1.06

/ IP

$300

/month

$270

/month

Quarterly

Cancel at anytime

Get discount below

Proxies

254 IPs

Subnet

/24 private subnet
on dedicated servers

Bandwidth

Unlimited

Threads

Unlimited

Speed

10GBPS

Support

Dedicated

Crypto