Free tools Windows power users keep installed

One-click scans. No signup required.

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

To use the Chrome DevTools Protocol (CDP) with a cloud browser, create a hosted Chromium session, get its authenticated CDP WebSocket endpoint, and connect using a CDP-aware client such as Playwright’s chromium.connectOverCDP() or Puppeteer’s connect(). The provider runs the browser; CDP is the control protocol; Playwright or Puppeteer is the client library you use to drive it.

The key practical distinction is that Playwright’s connectOverCDP() connects to a CDP endpoint, while Playwright’s connect() expects Playwright’s own protocol. Confirm which endpoint and protocol your provider supplies before writing the client.

What CDP does in a cloud-browser setup

The Chrome DevTools Protocol lets tools instrument, inspect, debug, and profile Chromium, Chrome, and other Blink-based browsers. Its domains expose commands and events for areas such as pages, network traffic, the DOM, debugging, and browser-level operations. The Chrome DevTools Protocol project describes it as a protocol for tools to instrument, inspect, debug, and profile Chromium and other Blink-based browsers.

A cloud browser provider starts and operates the browser process, then gives your application a remotely reachable WebSocket endpoint. Your application connects to that endpoint and sends CDP commands directly or uses a library that translates higher-level operations into browser commands. CDP is not itself a hosted browser, and Playwright or Puppeteer is not the cloud runtime.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Cloud provider: provisions Chromium, exposes the remote connection, and usually controls session creation and cleanup.
  • CDP: the browser-control protocol carried over the remote connection.
  • Client library: Playwright, Puppeteer, or another CDP-aware tool used by your code.

How to connect: the provider-neutral workflow

  1. Choose a provider and region. Check supported browsers, endpoint format, authentication, concurrent-session limits, maximum session duration, and whether sessions or browser profiles persist.
  2. Create a browser session. Use the provider’s dashboard, API, or SDK. Providers differ in how sessions are created and whether an API call is needed before the WebSocket connection is available.
  3. Get the CDP WebSocket URL. The provider may return a URL directly or expose it through a session response. Treat it as a secret if it contains a token.
  4. Connect with the CDP method for your library. In Playwright use chromium.connectOverCDP(); in Puppeteer use its browser connection API, commonly puppeteer.connect().
  5. Select or create a page. A provider may hand you a browser with an existing target, or expect you to create a page after connecting.
  6. Run the task, then close or recycle the session. Follow the provider’s lifecycle instructions so unused sessions do not linger and retained state does not leak into another job.

Do not assume every provider’s endpoint, authentication format, or session lifecycle is interchangeable. For example, Browserless documents a public connection URL and separates it from its internal wsEndpoint(); its public URL includes the externally accessible host and a tokenized path. See the Browserless documentation for its current endpoint details.

Playwright example: connect over CDP

Install Playwright for Node.js with npm install playwright. Obtain the WebSocket URL from your cloud provider, then set it as an environment variable rather than embedding a credential in source code. The following example assumes the provider has already created a session and that its CDP endpoint is available as CDP_WS_ENDPOINT.

import { chromium } from 'playwright';

const endpoint = process.env.CDP_WS_ENDPOINT;
if (!endpoint) throw new Error('Set CDP_WS_ENDPOINT to the provider CDP WebSocket URL');

const browser = await chromium.connectOverCDP(endpoint);
try {
  const context = browser.contexts()[0] ?? await browser.newContext();
  const page = context.pages()[0] ?? await context.newPage();

  await page.goto('https://example.com', { waitUntil: 'domcontentloaded' });
  console.log(await page.title());
} finally {
  await browser.close();
}

This example uses an existing context and page when the provider supplies them, otherwise it creates them. Provider-managed sessions may require a different cleanup call: in some services, closing the browser connection also ends the remote session; in others, the provider has a separate session-close API. Follow that provider’s lifecycle guidance.

Browserless explicitly recommends connectOverCDP for its default CDP endpoint rather than Playwright’s connect. The latter uses Playwright’s own protocol and is not a general substitute for a CDP WebSocket endpoint. See Browserless’s connection guidance.

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

Puppeteer example: connect to a remote browser

Install Puppeteer with npm install puppeteer. Put the provider’s CDP WebSocket URL in CDP_WS_ENDPOINT, then connect and drive a page:

import puppeteer from 'puppeteer';

const endpoint = process.env.CDP_WS_ENDPOINT;
if (!endpoint) throw new Error('Set CDP_WS_ENDPOINT to the provider CDP WebSocket URL');

const browser = await puppeteer.connect({ browserWSEndpoint: endpoint });
try {
  const pages = await browser.pages();
  const page = pages[0] ?? await browser.newPage();
  await page.goto('https://example.com', { waitUntil: 'domcontentloaded' });
  console.log(await page.title());
} finally {
  await browser.disconnect();
}

disconnect() closes the client’s connection without necessarily shutting down the provider’s browser. Use the provider’s session API when you need to end the hosted browser itself. Confirm current Puppeteer API details against the Puppeteer documentation.

Finding a browser-level endpoint on a self-managed Chrome instance

If you control the Chrome process rather than using a hosted provider, Chrome can expose remote debugging endpoints. The browser-level WebSocket URL is listed as webSocketDebuggerUrl in the JSON response from /json/version on the debugging port. For example, if debugging is listening on a local port, request http://localhost:9222/json/version and read that field from the JSON. The same debugging port provides HTTP endpoints for listing, opening, activating, and closing targets.

A hosted browser provider normally gives you an externally reachable endpoint instead; do not assume its URL can be reconstructed from the self-managed Chrome pattern. Cloudflare Browser Run documents a model in which a browser session connects through a /devtools/browser WebSocket endpoint and also provides HTTP endpoints for session and tab operations. See Cloudflare Browser Run documentation for its session model and current interface.

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

Using the endpoint safely in CI/CD

A CDP endpoint is a powerful control channel: anyone who can use it may be able to inspect or operate the remote browser. Chrome’s configuration guidance warns that connecting to an existing browser session can inherit its logged-in accounts, cookies, and other data. See Chrome’s remote-debugging guidance.

  • Store provider tokens and WebSocket URLs in your CI secret store, not in the repository or command-line output.
  • Do not print a complete tokenized endpoint to build logs. If connection diagnostics are needed, redact credentials.
  • Use isolated browser sessions or profiles for unrelated users and jobs; do not share a logged-in session across workloads.
  • Restrict who can read CI secrets and rotate credentials if an endpoint or token is exposed.
  • Keep region and endpoint configuration environment-specific. Provider documentation indicates that regions and fleet types can affect endpoint hostnames.
  • Set bounded timeouts and ensure the cleanup path runs even when navigation or assertions fail.

Cloudflare states that its CDP endpoints can be reached from local machines, external servers, and CI/CD pipelines. That establishes connection availability, not a universal guarantee about latency, capacity, or session duration; check the limits for the provider and plan you select.

How to compare cloud-browser providers

There is no controlled cross-provider benchmark here for speed, cost, or reliability, so those qualities need to be checked against your own workload. Compare providers on operational behavior, not just whether they expose a URL labeled “CDP.”

What to compare Questions to verify
Protocol compatibility Is the endpoint a CDP WebSocket, or does it require a provider SDK or a different protocol? Which client-library connection method is supported?
Endpoint and authentication How is the endpoint obtained? Is its token embedded in the URL, supplied separately, or scoped to a session?
Region and latency Which regions and browser fleet types are available? Measure your own navigation and task timings from the CI region you will use.
Concurrency and duration How many sessions can run at once, and what is the maximum session lifetime? These are provider- and plan-specific.
Session lifecycle How are sessions created and closed? Can you list tabs, create or close targets, and recover from a disconnected client?
Persistence and isolation Can state persist between sessions, and how is it isolated? Decide whether your task needs retained cookies or a clean browser each run.
Debugging visibility Can you inspect logs, browser errors, or session status without exposing credentials or user data?
Pricing and CI integration How are browser time, concurrency, storage, and other usage charged? Is the provider’s API convenient for your build system?

Browserless provides CDP endpoints and Playwright/Puppeteer connection instructions; Cloudflare Browser Run documents session, tab, and CI/CD access patterns. Those are relevant technical options, but the documentation cited here does not establish a universal winner or support comparative claims about measured performance or reliability.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting common connection failures

Playwright reports that the endpoint is not a Playwright endpoint

Likely cause: the code called chromium.connect() against a CDP endpoint. Fix: use chromium.connectOverCDP(endpoint) for a CDP WebSocket. Use connect() only when the service supplies a Playwright-protocol endpoint.

The WebSocket connection is refused or times out

Likely causes: the session was not created, the URL is stale or malformed, the endpoint is not reachable from the runner, or a provider-side session limit has been reached. Fix: create a fresh session, use the exact returned endpoint, verify that the runner can reach the provider, and check session limits and region-specific hostname configuration.

Authentication fails

Likely causes: a missing, expired, or incorrectly encoded token, or use of an internal endpoint instead of the public connection URL. Fix: retrieve a current endpoint using the provider’s documented method, preserve its exact encoding, and use the correct credential source. Do not paste the secret URL into a public issue or log.

The connection works but there is no page

Likely cause: the provider returns a browser with no open targets, while the script assumes one exists. Fix: check existing contexts and pages, then create a page or target using the client library or provider API.

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

The script finishes but the browser session remains active

Likely cause: disconnecting the client is not the same as ending the provider session. Fix: use the provider’s explicit close-session operation when required, and distinguish that from closing a Playwright or Puppeteer connection.

A later job sees prior logins or cookies

Likely cause: a persistent or reused browser profile. Fix: use isolated sessions or profiles for jobs that should not share state, and clear or discard retained data according to the provider’s controls.

Performance, reliability, and cost: what to measure

Published official documentation cited here does not provide authoritative cross-provider speed, cost, or reliability statistics. Avoid treating a provider’s region list or CI/CD support as proof that it will meet a specific service-level target. Measure with the pages, region, concurrency, and session duration your own automation uses.

  • Record connection time separately from page navigation and task execution time, so endpoint setup is not confused with browser work.
  • Test at representative concurrency and across the regions your jobs will use; check whether failures correlate with load or session duration.
  • Track session creation failures, WebSocket disconnects, navigation timeouts, and cleanup outcomes separately.
  • Estimate cost from the provider’s current pricing model and your actual session usage. Verify whether billing is based on time, sessions, concurrency, or other usage rather than assuming a common unit.

Or skip the browser setup

If the job is simply to obtain a page screenshot or PDF, ScreenshotNeo is a direct alternative: one GET request returns an image or PDF, without requiring you to provision and connect a remote browser yourself. Its consent-banner, newsletter-popup, and chat-widget cleanup can be turned off step by step; bot checks, blank pages, failed loads, timeouts, and cache hits are not billed, with response headers indicating page verdict and billing status. It also has an MCP server with screenshot, page-info, and PDF tools for AI agents.

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

cURL example, using the documented endpoint and options (ScreenshotNeo API docs):

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp

The free plan includes 1,000 screenshots per month without a card; paid plans start at $5 for 3,000. Sign up for ScreenshotNeo and get 1,000 free screenshots a month, with no card required.

Frequently Asked Questions

Can I connect a local Playwright script to a cloud browser?

Yes, when the provider exposes a remotely reachable CDP endpoint and allows connections from your machine. Use Playwright’s CDP connection method and protect any tokenized endpoint.

Does CDP only work with Google Chrome?

No. CDP is used with Chromium, Chrome, and other Blink-based browsers, though supported commands and provider behavior can vary.

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

Can I use Puppeteer with a CDP cloud endpoint?

Yes, if the provider supports Puppeteer-compatible CDP connections. Use Puppeteer’s browser connection API with the provider’s WebSocket endpoint.

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.