Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Connect Puppeteer to a remote browser with puppeteer.connect(), not puppeteer.launch(). Pass the browser provider’s secure WebSocket URL in browserWSEndpoint, automate pages with the same Puppeteer APIs you use locally, and always close the connection in a finally block. The Browserless flow below is a provider-specific example: endpoint syntax, authentication, file transfer, concurrency, and billing rules vary by host.

What changes when the browser is remote?

Puppeteer is a JavaScript library with a high-level API for automating Chrome and Firefox through the Chrome DevTools Protocol and WebDriver BiDi. Navigation, selectors, waits, DOM evaluation, screenshots, PDFs, and UI tests generally remain page-level Puppeteer code. The major change is how the browser starts and where it runs.

Concern Local execution Remote execution
Connection puppeteer.launch() starts a local browser. puppeteer.connect() attaches to a provider-issued WebSocket endpoint.
Package The full puppeteer package can download a compatible browser. For Browserless, puppeteer-core avoids downloading a Chromium binary you will not run locally.
Files Browser and Node.js process can see the same filesystem. The browser host cannot see paths on your Node.js machine; use the provider’s upload/download mechanism.
Environment Defaults come from your machine. Viewport, user agent, timezone, locale, browser version, and region can differ.
Sessions You control process lifetime. Each connection consumes a remote session; an unclosed session can remain active until timeout and may accrue billing.

Prerequisites and endpoint safety

  • Node.js with ES-module support (or adapt the import to CommonJS).
  • A remote-browser account and a WebSocket endpoint. Browserless documents a secure wss:// endpoint with a token in the query string.
  • The endpoint stored in an environment variable such as BROWSER_WS_ENDPOINT.

A WebSocket endpoint is not an HTTPS page URL. Authentication is provider-specific; follow the selected host’s current instructions. Treat a token-bearing URL like a password: do not commit it, print it, or include it in error logs. Provider endpoint parameters can change, so use the endpoint shown in the current provider console or documentation.

Minimal remote connection

Install the client library:

npm install puppeteer-core

Set your endpoint outside source control, then run this complete script:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
import puppeteer from 'puppeteer-core';

const endpoint = process.env.BROWSER_WS_ENDPOINT;
if (!endpoint) throw new Error('Set BROWSER_WS_ENDPOINT');

const browser = await puppeteer.connect({
  browserWSEndpoint: endpoint,
});

try {
  const page = await browser.newPage();
  await page.setViewport({ width: 1365, height: 900, deviceScaleFactor: 1 });
  await page.goto('https://example.com', {
    waitUntil: 'networkidle2',
    timeout: 60_000,
  });
  console.log(await page.title());
  await page.screenshot({ path: 'example.png', fullPage: true });
} finally {
  await browser.close();
}

browser.close() ends the remote session. Put it in finally so navigation failures, selector timeouts, and thrown application errors do not leak a session.

Keep page automation familiar

Navigation and waits

await page.goto(url, { waitUntil: 'domcontentloaded' });
await page.waitForSelector('[data-ready="true"]', { timeout: 30_000 });
await page.locator('button[type="submit"]').click();

Remote latency makes explicit readiness conditions more dependable than arbitrary short sleeps. Use a selector, a documented application state, or an appropriate network-idle condition. Avoid assuming that “network idle” means every third-party request has finished.

DOM queries and evaluation

const heading = await page.locator('h1').innerText();
const links = await page.$$eval('a', nodes =>
  nodes.map(a => ({ text: a.textContent?.trim(), href: a.href }))
);
const result = await page.evaluate(() => ({
  title: document.title,
  width: document.documentElement.scrollWidth,
}));

The functions execute in the remote page context. Values returned to Node.js must be serializable; local Node.js variables and local filesystem paths are not magically available inside the browser.

Authentication and browser settings

await page.setExtraHTTPHeaders({ 'X-Test-Run': 'remote' });
await page.setUserAgent('Mozilla/5.0 automation-test');
await page.emulateTimezone('America/New_York');
await page.setGeolocation({ latitude: 40.7128, longitude: -74.0060 });

Use the provider’s context or endpoint options for settings that must exist before a page opens. Compare viewport, user agent, timezone, and locale when a remote run renders differently from a local run.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

Files, downloads, and uploads

A path such as /Users/alex/report.pdf refers to the Node.js host, not the remote browser machine. For uploads, transfer bytes through the provider’s supported mechanism or expose a controlled URL that the browser can fetch. For downloads, use the provider’s download or artifact API, or stream data back through an application endpoint. Do not build a workflow that assumes both machines share a mounted directory.

Browser configuration and endpoint parameters

With a local launch, options such as executable path and launch flags are passed to launch(). A managed browser may already be running before Puppeteer connects, so the provider can require these options as endpoint query parameters. Some hosts encode array-valued options as JSON. Never copy a local launch() object into connect() and assume it will work; consult the host’s endpoint schema and URL-encode values.

Sessions, concurrency, and latency

Reuse one connection per job

Each Puppeteer connection is a session under the documented Browserless model. Open multiple pages on one browser for a single job:

const browser = await puppeteer.connect({ browserWSEndpoint: endpoint });
try {
  const [catalog, checkout] = await Promise.all([
    browser.newPage(),
    browser.newPage(),
  ]);
  await Promise.all([
    catalog.goto('https://example.com/catalog'),
    checkout.goto('https://example.com/checkout'),
  ]);
} finally {
  await browser.close();
}

For genuinely parallel jobs, create separate connections and count each against the provider’s concurrency limit. Queue work when the plan cannot support the requested number of simultaneous sessions.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

Place the browser near the target

Page traffic travels between the remote browser and the target site, while control messages travel between your Node.js process and the browser. Select a region close to the sites you test when the provider offers regional choices. Keep timeouts realistic for both network distance and page work; do not treat a transient timeout as proof that selectors are wrong.

Troubleshooting remote Puppeteer

“Invalid URL” or connection refused

  • Confirm the value is a WebSocket endpoint beginning with wss:// for Browserless, not https://.
  • Check that the token and any query parameters are current and URL-encoded.
  • Verify outbound WebSocket traffic is allowed by your CI or firewall.

Local works, remote renders differently

Log and deliberately set viewport, user agent, timezone, locale, and geolocation. A different browser version, region, cookie state, or font set can alter layout and content without any change to your selectors.

Uploads or downloads fail

Replace local paths with the provider’s file-transfer API or an authenticated object-storage URL. Check which machine owns the path before debugging Puppeteer code.

Jobs become expensive or concurrency is exhausted

Ensure every code path reaches browser.close(). Reuse one browser for pages in a job, cap parallel connections, and add queueing and cancellation around work that may outlive its caller.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

Browser flags are ignored

Because the managed browser starts before attachment, move supported options into the provider’s endpoint query parameters. Encode JSON arrays exactly as that provider documents.

When remote hosting is the right choice

  • Choose local launch when you need complete control of installation, browser binaries, launch flags, and a developer workstation.
  • Choose a managed browser when CI, serverless code, or a separate execution region should run browsers without maintaining Chromium infrastructure.
  • Check file-transfer requirements before migrating jobs that depend on local downloads, fixtures, or mounted volumes.
  • Check concurrency and session accounting before increasing parallelism; provider limits are plan and service specific.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

For a single website screenshot rather than interactive browser automation, ScreenshotNeo provides a GET-based screenshot API. It removes cookie/consent banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, failed loads, timeouts, and cache hits are not billed, with the result identified by response headers. Its MCP server exposes take_screenshot, get_page_info, and capture_pdf to Claude, Cursor, and other MCP clients.

Install nothing for this request. The same endpoint supports PNG, JPEG, WebP, or PDF and has options for full-page lazy-image loading, CSS-selector elements, dark mode, device presets, retina scale, PDF paper and margins, custom CSS or JavaScript, clicks, waits, blocking, headers, cookies, user agents, authorization, timezone, geolocation, transparent backgrounds, resizing, TTL caching, signed image links, asynchronous webhooks, bulk capture, usage reporting, and an OpenAPI specification.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
r.raise_for_status()
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`Screenshot failed: ${res.status}`);
const fs = await import('node:fs/promises');
await fs.writeFile('shot.webp', Buffer.from(await res.arrayBuffer()));

See the parameter reference and response details in the ScreenshotNeo documentation. The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots, and every feature is available on every plan. Create a free ScreenshotNeo account.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

FAQ

Can I use the full puppeteer package instead of puppeteer-core?

Yes. connect() works with the full package, but it may download a local browser binary that a remote-only workflow does not need. Browserless documents puppeteer-core for that reason.

Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

Do concurrent scripts need separate connections?

Under the documented provider model, each concurrent job should use its own connection and counts toward the concurrency limit. Pages belonging to one job can share a connection.

Is the WebSocket endpoint universal across providers?

No. The secure WebSocket and token query-string format described here is the Browserless example. Other hosts can use different endpoint paths, authentication, options, and lifecycle rules.

Frequently Asked Questions

How do I rotate a leaked remote-browser token?

Revoke or regenerate it in the provider’s account console, replace the environment variable in every deployment, and review logs and source control for copies of the old URL.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Should I reconnect for every page?

Normally no. Create one connection for a job and open additional pages on that browser; reconnect only when a separate job or isolation boundary requires it.

Why does a remote screenshot differ by region?

Target sites can vary content, consent state, localization, and latency by IP region. Set locale and timezone deliberately and choose a browser region appropriate for the site under test.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.