Kernel browsers were designed to be lightweight, fast, and efficient for cloud-based browser automation at scale. They can be used as part of the Kernel app platform or connected a remote service with Chrome DevTools Protocol.

Remote Kernel browsers have the same capabilities as on our app platform, including:

You don’t need to pass an invocation ID in browsers.create() when creating remote Kernel browsers.

1. Create a remote Kernel browser

import { Kernel } from '@onkernel/sdk';
const kernel = new Kernel();
const kernelBrowser = await kernel.browsers.create();

2. Connect to the browser with the Chrome DevTools Protocol

Then, you can connect to the browser with any Chrome DevTools Protocol framework, such as Playwright or Puppeteer.

const browser = await chromium.connectOverCDP(kernelBrowser.cdp_ws_url);

Full example

Once you’ve connected to the Kernel browser, you can do anything with it.

import { Kernel } from '@onkernel/sdk';
const kernel = new Kernel();

const kernelBrowser = await kernel.browsers.create();
const browser = await chromium.connectOverCDP(kernelBrowser.cdp_ws_url);
try {
    const context = await browser.newContext();
    const page = await context.newPage();
    await page.goto("https://www.google.com");
    const title = await page.title();
} catch (error) {
    console.error(error);
} finally {
    await browser.close();
}