The lil’bots platform comes with Broswebase access built in. You can use the Browserbase API to easily spin up a headless browser in your bots and performan actions like scraping websites, automating tasks, and more.

The browserbase API is the easiest way to interact with the web in your bots. You can use the browserbase API to create a headless browser, navigate to a website, interact with the page, and more. Browserbase offers advanced built in proxying and captcha solving, so you can easily scrape websites, automate tasks, and more.

Using Broswerbase with Playwright in JavaScript

See the example below for how to use Browserbase with Playwright in your bots. In this example we use Playwright to create a headless browser, navigate to a website, and take a screenshot of the page.

import { chromium } from "npm:playwright-core";

export async function main(inputs, params, accounts) {
	const { url } = inputs;

	const browser = await chromium.connectOverCDP(`wss://connect.browserbase.com`);

	// Getting the default context to ensure the sessions are recorded.
	const defaultContext = browser.contexts()[0];
	const page = defaultContext.pages()[0];

	console.log("Navigating to your landing page")

	await page.goto(url);
	await page.screenshot({ path: './screenshot.png', fullPage: true, timeout: 60000 });
	await page.close();
	await browser.close();

	return [{
		title: "Screenshot",
		file: "./screenshot.png",
		type: "image",
	}]
}
Note that while running bots you may see the following error printed out. It is normal and should not impact the normal operation of the bot: Warning: Not implemented: ClientRequest.options.createConnection