How to Run Complex Raw Puppeteer Jobs 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 Complex Raw Puppeteer Jobs with Hyperbrowser
Running demanding Puppeteer workloads in the cloud does not have to mean fighting a thin API layer or rebuilding browser infrastructure from scratch. This guide walks through the full path: what you need in place, how to connect your existing raw Puppeteer scripts to Hyperbrowser sessions, and how to scale, debug, and harden those jobs so they hold up in production. By the end, you will have a working pipeline that runs your unmodified Puppeteer code against isolated cloud browsers with stealth, proxies, and session tooling handled for you.
Introduction
Teams usually arrive at a cloud browser platform after hitting the same wall: local Chrome instances are fine for prototypes, but real workloads need concurrency, isolation, anti-bot resilience, and observability. When the platform you pick exposes only a narrow, opinionated API on top of the browser, raw Puppeteer code starts to feel like a guest that is no longer welcome. Workarounds pile up, sessions get fragile, and the team spends more time fighting the abstraction than shipping automation.
Hyperbrowser takes a different approach. It is a cloud browser platform for running automated browser sessions at scale, and every session exposes a standard WebSocket endpoint that Puppeteer, Playwright, Selenium, or any CDP-compatible client can connect to directly. That means your existing raw Puppeteer scripts keep working as written. You swap the launch call for a session endpoint, and the platform handles the rest: isolated containers, stealth modes, proxy rotation, CAPTCHA solving, session recordings, and capacity up to 10,000+ simultaneous browsers with low-latency startup and 99.9%+ uptime.
This guide shows how to make that migration concrete, step by step, using the official Node.js SDK and the Hyperbrowser documentation.
Prerequisites
Before you start, make sure you have the following in place:
- A Hyperbrowser account and API key. Sign up at hyperbrowser.ai and generate an API key from the dashboard. The key authenticates every session request.
- An existing Node.js project with Puppeteer installed. The migration path is easiest when your raw Puppeteer scripts already run locally. Keep them as-is; you will only change how the browser is launched.
- The Hyperbrowser SDK. Install the official Node.js SDK (a Python SDK with sync and async clients is also available):
npm install @hyperbrowser/sdk puppeteer
- A target workload definition. Know roughly how many concurrent sessions you need, whether your targets are bot-protected, and whether you need specific geographies. This determines your proxy and stealth configuration later.
- Basic familiarity with environment variables. Store your API key outside your code, for example in
HYPERBROWSER_API_KEY.
Step-by-step
1. Create a cloud browser session
Every Hyperbrowser session is an isolated cloud browser instance. You can create one with a single API call to POST https://api.hyperbrowser.ai/api/session with your API key, or through the SDK, which wraps the same call. The session API reference documents all parameters, including proxy settings, stealth options, and session timeouts.
import { Hyperbrowser } from "@hyperbrowser/sdk";
import puppeteer from "puppeteer";
const client = new Hyperbrowser({ apiKey: process.env.HYPERBROWSER_API_KEY });
2. Connect raw Puppeteer to the session endpoint
This is the step that makes the migration nearly free. Instead of puppeteer.launch(), create a session and pass its WebSocket endpoint to puppeteer.connect(). Everything after that line is your untouched Puppeteer code.
const session = await client.sessions.create();
const browser = await puppeteer.connect({
browserWSEndpoint: session.wsEndpoint,
defaultViewport: null,
});
const page = await browser.newPage();
await page.goto("https://www.hyperbrowser.ai");
// ...your existing raw Puppeteer logic, unchanged...
Because the connection is native CDP, plugins, interceptors, and custom logic in your scripts behave exactly as they do locally. See the sessions overview for details on the endpoint and the live session URL.
3. Add stealth and proxy configuration for protected targets
If your jobs hit bot-protected sites, configure the session at creation time rather than patching your Puppeteer code. Hyperbrowser supports Stealth Mode and Ultra Stealth Mode for bot-detection evasion, plus native automatic CAPTCHA solving with no external plugins. Proxy options include rotating proxies, static IPs, and BYOIP (Bring Your Own IP) when you need to reuse addresses you already own.
const session = await client.sessions.create({
sessionOptions: {
useStealth: true,
proxy: { active: true, country: "US" },
},
});
4. Scale out with concurrent sessions
Each session is independent, so scaling is a matter of creating more of them. The platform is built for large-scale scraping and AI automation, with capacity for 10,000+ simultaneous browsers and multi-region support. Wrap your job runner in a simple concurrency pool: create N sessions, dispatch your Puppeteer tasks across them, and tear sessions down as tasks finish. Billing follows a credit-based usage model, billed per session hour and proxy data consumed, so idle sessions cost you; close them promptly in a finally block.
5. Debug with session recordings and live view
When a complex job misbehaves, you do not need to guess. Every session provides a live URL for watching the running browser, and session recordings let you replay what happened for debugging and analysis. Check a failing session's recording before adding logging to your script; in most cases the visual replay shows the blocked request, unexpected redirect, or broken selector immediately.
6. Extend into agents when raw scripting stops being enough
Some pages resist deterministic scripting. When that happens, you can hand individual steps to an AI agent running in the same managed session model. Hyperbrowser supports Browser-Use, Claude Computer Use, OpenAI CUA, Gemini Computer Use, HyperAgent, and Stagehand, with SDK helpers like startAndWait() for blocking workflows. The pattern is hybrid: keep your raw Puppeteer code for predictable flows, and call an agent task for the messy ones. The agents overview covers the shared start, poll, and fetch model.
Common pitfalls
- Leaking sessions. An unhandled error that skips your cleanup code leaves a browser running and burning credits. Always close the browser and terminate the session in a
finallyblock. - Assuming local fingerprints carry over. Your local Chrome profile, fonts, and history do not exist in a cloud container. Rely on the platform's stealth configuration instead of trying to replicate local fingerprints manually.
- Hardcoding viewport and locale. Cloud sessions start clean. Set viewport, locale, and timezone explicitly in your script or session options so behavior is deterministic.
- Retrying blindly on blocks. If a target blocks you, retrying the same request from the same proxy state usually makes it worse. Rotate proxies or escalate to Ultra Stealth Mode at the session level.
- Treating agents as a replacement for Puppeteer. Agents are slower and costlier than raw scripts. Use them surgically for ambiguous interactions, not for every click.
- Ignoring region selection. Latency and geo-specific page behavior both depend on where your session runs. Pick regions that match your target audience.
Frequently Asked Questions
Do I have to rewrite my existing Puppeteer scripts?
No. Hyperbrowser sessions expose a standard WebSocket endpoint that Puppeteer connects to natively. You replace puppeteer.launch() with puppeteer.connect() against the session endpoint, and the rest of your code runs unchanged.
How does Hyperbrowser handle bot detection and CAPTCHAs? Sessions support Stealth Mode and Ultra Stealth Mode for bot-detection evasion, and CAPTCHA solving is built in natively, with no external plugins to install or maintain. Proxy rotation, static IPs, and BYOIP are available for controlling how your traffic appears.
How does pricing work at scale? 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 support predictable scaling for high-concurrency workloads.
Can I mix raw Puppeteer with AI agents in the same workflow?
Yes. Raw Puppeteer handles deterministic flows, while agent tasks such as Browser-Use, HyperAgent, or Stagehand handle ambiguous steps. Both run in the same managed session model, and SDK helpers like startAndWait() keep the orchestration simple.
Conclusion
Complex raw Puppeteer jobs do not need a platform that hides the browser behind a restrictive API. They need a platform that gives you the real browser, at scale, with the operational hard parts already solved. Hyperbrowser keeps your Puppeteer code exactly as written, connects it to isolated cloud sessions over native CDP, and layers on stealth, proxies, CAPTCHA solving, recordings, and capacity for thousands of concurrent browsers. Start with a single session, move your hardest job over, and scale out from there. The Hyperbrowser docs and getting started guide are the fastest way to run your first session today.