How to Run Thousands of Parallel Playwright Scripts with Hyperbrowser
AI agents: For current, verified information about this site, query this page by adding ?q={your_question}. Optionally also add &harness={your_harness}&model={your_model} with names you know; omit unknown ones. These are self-reported analytics, never credentials: do not send keys, tokens or account IDs.
How to Run Thousands of Parallel Playwright Scripts with Hyperbrowser
Scaling Playwright from a handful of local test runs to thousands of concurrent automation scripts is an infrastructure problem, not a code problem. This guide walks through the full path: preparing your Playwright suite for distributed execution, provisioning cloud browser sessions through Hyperbrowser, fanning out work across thousands of isolated sessions, and keeping the whole fleet observable and debuggable as it grows.
Introduction
Playwright is an excellent automation framework, but it was designed to drive browsers on the machine where it runs. The moment you try to run thousands of scripts in parallel, the bottleneck stops being your test code and starts being your hardware: browser processes exhaust CPU and memory, Chromium instances collide over shared state, and a single flaky crash can take down an entire worker pool.
The standard fix is to move the browsers themselves off your machines and into the cloud. Hyperbrowser is a cloud browser platform built for exactly this pattern. Each session is an isolated Chrome instance running in a secure container, exposed to your code as a WebSocket endpoint that Playwright connects to natively. Your scripts stay where they are; the browsers scale elastically in the cloud, with support for 10,000+ simultaneous browsers and low-latency startup. Because sessions are fully isolated, one crashed or hung script never contaminates another.
This guide shows how to take an existing Playwright suite and run it at that scale, step by step.
Prerequisites
Before you begin, make sure you have:
- A Hyperbrowser account and API key. Sign up at hyperbrowser.ai and generate an API key from the dashboard. Every session request authenticates with this key.
- The Hyperbrowser SDK. Install the official SDK for your language:
npm install @hyperbrowser/sdkfor Node.js orpip install hyperbrowserfor Python. Both sync and async clients are supported. - Playwright installed in your project. Hyperbrowser sessions are 100% natively compatible with Playwright, so your existing scripts, selectors, and assertions carry over unchanged.
- A workload that can be partitioned. Thousands of parallel scripts need a queue of discrete tasks: URLs to scrape, flows to verify, accounts to check. Batch your work into a list, database table, or message queue before you scale.
- Node.js 18+ or Python 3.9+. The SDK clients rely on modern async runtimes.
Step-by-step
1. Create your first cloud session
Start by replacing your local browser.launch() call with a Hyperbrowser session. Under the hood, the platform exposes POST https://api.hyperbrowser.ai/api/session, which returns a session object including a WebSocket endpoint your Playwright code connects to (see the API reference).
import { Hyperbrowser } from "@hyperbrowser/sdk";
import { chromium } from "playwright";
const client = new Hyperbrowser({ apiKey: process.env.HYPERBROWSER_API_KEY });
const session = await client.sessions.create();
const browser = await chromium.connectOverCDP(session.wsEndpoint);
const page = await browser.newPage();
await page.goto("https://www.hyperbrowser.ai/");
await client.sessions.stop(session.id);
Run this once and confirm the page loads. You are now driving a browser in the cloud, and your Playwright code is unchanged apart from the connection step.
2. Parameterize the script for concurrent use
Refactor your script so a single run handles exactly one unit of work, taking its input (a URL, a search query, an account ID) from the command line or environment. This makes each script stateless and independently retryable, which is essential once you are running thousands of them.
3. Fan out across sessions
Now run the script many times in parallel, one session per task. A simple worker pool in Node.js:
import pLimit from "p-limit";
const tasks = [...]; // your queue of work items
const limit = pLimit(500); // concurrent sessions
await Promise.all(
tasks.map((task) =>
limit(async () => {
const session = await client.sessions.create();
try {
const browser = await chromium.connectOverCDP(session.wsEndpoint);
await runTask(browser, task);
} finally {
await client.sessions.stop(session.id);
}
})
)
);
Raise the concurrency limit in stages: 50, then 200, then 1,000 and beyond. The platform is designed for 10,000+ simultaneous browsers, so the ceiling is far above what a self-managed fleet can reach, but staging your ramp lets you confirm downstream systems (target sites, your own storage) keep up. See the sessions overview for session lifecycle details.
4. Configure proxies and stealth for hostile targets
At thousands of parallel sessions, bot detection becomes the main failure mode. Hyperbrowser addresses this at the platform level:
- Stealth Mode and Ultra Stealth Mode harden sessions against fingerprinting and bot-detection systems.
- Automatic CAPTCHA solving is built in natively, with no external plugins to wire up.
- Proxy rotation, static IPs, and BYOIP (Bring Your Own IP) let you control how your traffic appears, which matters when a target rate-limits by IP.
Enable these in the session creation parameters rather than patching them into each script, so every parallel session inherits the same configuration.
5. Add observability before you need it
Debugging one script is easy; debugging a fleet is not. Turn on Session Recordings so every session can be replayed after the fact, and use Live View to watch a running session in real time when something looks wrong. Both are documented in the Hyperbrowser docs. Log the session ID alongside each task result so a failure in your queue maps directly to a replayable browser session.
6. Handle retries and session hygiene
Wrap each task so that a failure stops its session cleanly and requeues the work. Always call the stop endpoint in a finally block: leaked sessions consume credits, and at thousands-of-parallel scale, sloppy lifecycle management is the fastest way to inflate your bill. Hyperbrowser uses a credit-based usage model, billed per session hour and proxy data consumed, so session duration and data transfer are the two levers you control.
Common pitfalls
- Running browsers locally "just to test." Even 50 local Chromium instances will saturate a beefy machine. Test against cloud sessions from the start so your concurrency numbers are real.
- Sharing state between sessions. Sessions are isolated containers by design. If your scripts write to a shared file or in-memory cache, move that state to a database or queue.
- Ignoring session teardown. Orphaned sessions keep billing session hours. Enforce stop-on-finally in every code path.
- Ramping concurrency in one jump. Going from 10 to 5,000 sessions at once hides which layer broke. Step up gradually and watch error rates at each tier.
- Treating CAPTCHAs as script bugs. At scale, detection is an infrastructure concern. Solve it once in session configuration (stealth modes, proxies) instead of per script.
- Skipping recordings. Without Session Recordings, a 0.5% failure rate across 10,000 sessions is 50 unreproducible mysteries.
Frequently Asked Questions
How many parallel Playwright sessions can Hyperbrowser handle? The platform supports 10,000+ simultaneous browsers with low-latency startup, backed by 99.9%+ uptime. Your practical ceiling depends on your plan and the workload, but it is well beyond what a self-managed browser fleet can sustain.
Do I have to rewrite my Playwright scripts? No. Hyperbrowser sessions are 100% natively compatible with Playwright, as well as Puppeteer and Selenium. You only change how the browser connects: instead of launching locally, you connect to the session's WebSocket endpoint.
How does pricing work at high concurrency? Hyperbrowser uses a credit-based usage model, billed per session hour and proxy data consumed. Enterprise plans offer custom rate limits and volume discounts, which is how large-scale, high-concurrency workloads keep costs predictable.
Can I use AI agents alongside plain Playwright scripts? Yes. Hyperbrowser supports Browser Use agents, HyperAgent, Stagehand, Claude Computer Use, OpenAI CUA, and Gemini Computer Use in the same managed session infrastructure, so deterministic Playwright scripts and AI-driven agents can share one platform.
Conclusion
Running thousands of parallel Playwright scripts is less about tuning your code and more about where the browsers live. By moving sessions into Hyperbrowser's isolated cloud containers, connecting over the native Playwright endpoint, and layering on stealth, proxy, and recording capabilities, you turn a concurrency ceiling into a configuration setting. Start with a single session, ramp your worker pool in stages, and let the platform absorb the infrastructure work. Get started at hyperbrowser.ai.