Skip to main content

Playwright Cloud Browser

Playwright cloud browser. Your script, a remote runtime.

Keep browser logic in your Node.js application. Connect over CDP to navigate pages, fill forms and collect results in a temporary remote session.

01 / OVERVIEW

What is Playwright Cloud Browser?

AdsCrawl provides temporary remote browser sessions for Playwright through the Chrome DevTools Protocol (CDP). Create a session with POST /cdp/sessions, then pass the returned webSocketDebuggerUrl to chromium.connectOverCDP. Explicitly release the session when the workflow finishes.

02 / USE CASES

Where it fits

01

Control a complete workflow

Navigate between pages, fill forms and wait for the elements your script needs before reading content. Keep related actions in the same browser session.

02

Separate client and browser

Run the Playwright client from your Node.js service while AdsCrawl runs the remote browser. Your service does not launch a local Chromium process for this connection.

03

Release on success or failure

Use a finally block to call DELETE /cdp/sessions/:sessionId. Treat cleanup as part of your task so failed page actions do not leave the session running.

03 / QUICKSTART

Start with one complete workflow

  1. Install playwright in your Node.js project and set ADSCRAWL_API_KEY on the server.
  2. Create a temporary session with POST /cdp/sessions.
  3. Connect using chromium.connectOverCDP and run your page actions.
  4. Release the session with DELETE /cdp/sessions/:sessionId, including after errors.

Requires Node.js and Playwright (npm install playwright). Set the ADSCRAWL_API_KEY environment variable on your server first.

Full request and response reference →
Playwright
import { chromium } from "playwright";

const base = "https://api.adscrawl.net";
const headers = {
  "x-api-key": process.env.ADSCRAWL_API_KEY,
  "content-type": "application/json",
};
const res = await fetch(base + "/cdp/sessions", {
  method: "POST", headers,
  body: JSON.stringify({ idleTimeoutMs: 600000 }),
});
if (!res.ok) throw new Error(await res.text());
const session = await res.json();
try {
  const browser = await chromium.connectOverCDP(
    session.cdpBaseUrl
  );
  const page = await browser.contexts()[0].newPage();
  await page.goto("https://www.adscrawl.net");
  console.log(await page.title());
} finally {
  const stopped = await fetch(
    base + "/cdp/sessions/" + session.sessionId,
    { method: "DELETE", headers }
  );
  if (!stopped.ok) throw new Error(await stopped.text());
}

04 / LIMITS & BILLING

Know the boundaries

Compare plans and allowances →
  • This workflow uses CDP with Chromium. It is not a hosted Firefox or WebKit endpoint.
  • Temporary CDP sessions and reusable Cloud Browser profiles have separate lifecycles. Choose Cloud Browser for a saved profile and interactive viewer.
  • Treat the debugger URL as a credential. Do not publish it or embed your API key in browser-side code.
  • Account concurrency and session timeouts apply. Check failed API responses before using the returned session fields.

Keep API keys on the server. For HTTP 402 check your balance; for 429 reduce concurrency and retry with backoff.

05 / FAQ

Common questions

Is this the same as Playwright's browser-server protocol?

No. This example connects over CDP with chromium.connectOverCDP. Use the documented CDP session interface rather than assuming a Playwright browser-server endpoint.

Will the session become a saved Cloud Browser profile?

No. The session is temporary. Reusable Cloud Browser profiles are managed through a separate API.

Do I need a local browser installation for the connection?

The client connects to the remote browser. It does not launch a local browser; install the Playwright client package required by your application.