Browser automation
AdsCrawl for Playwright
Run your Playwright automation against AdsCrawl's remote Chromium browsers. Create a CDP session, connect with your existing library, perform browser actions, and release the session when the work ends.
What you can do
Reuse browser code
Keep page navigation, selectors, clicks and form input in your existing automation library.
State within a session
Reuse pages and browser context for related steps without creating a browser for every request.
Inspect the result
Read DOM content and save screenshots using your browser library, then close the remote session.
Before you start
- Node.js 20+
- An AdsCrawl account and API key.
- Set ADSCRAWL_API_KEY in the environment of the process running your client. Keep it out of browser code and source control.
SETUP METHOD 01
Remote CDP
Use chromium.connectOverCDP with the returned cdpBaseUrl.
Install the clients
The core package connects to a remote browser; no local Chromium download is needed for this example.
npm install adscrawl playwright-coreSet the API key
Set ADSCRAWL_API_KEY in the environment of the process running your client. Keep it out of browser code and source control.
Connect, read and clean up
Run as a Node.js ES module. The example reads the page title and uses finally to request session closure even if navigation fails.
import { chromium } from 'playwright-core'; import AdsCrawl from 'adscrawl'; const client = new AdsCrawl(); const session = await client.cdp.create({ idleTimeoutMs: 600_000, maxSessionMs: 3_600_000, browserSettings: { viewport: { width: 1440, height: 900 } }, }); try { const browser = await chromium.connectOverCDP(session.cdpBaseUrl); const context = browser.contexts()[0] ?? await browser.newContext(); const page = context.pages()[0] ?? await context.newPage(); await page.goto('https://example.com'); console.log(await page.title()); } finally { await client.cdp.close(session.sessionId); }
Usage & limits
- Remote CDP connects to Chromium. This is not a Firefox or WebKit endpoint, and Playwright's CDP connection differs from its native Playwright protocol.
- API requests and browser sessions use your AdsCrawl account credits. Installing a client does not include a separate usage allowance.
- Close remote sessions after use. A disconnected client or closed viewer does not confirm that the server-side session has stopped.