Here’s a simple example extension that modifies page titles. It consists of two files:
{ "manifest_version": 3, "version": "1.0", "name": "My Test Extension", "description": "Test of a simple browser extension", "content_scripts": [ { "matches": [ "https://www.sfmoma.org/*" ], "js": [ "content-script.js" ] } ]}
You can download this sample extension
here. The
extension must be in a .zip file format with a manifest.json at the root.
The file must be less than or equal to 100 MB.
To use your extension, create a new session with the extension enabled:
Node.js
Python
import { Browserbase } from '@browserbasehq/sdk';const bb = new Browserbase({ apiKey: process.env.BROWSERBASE_API_KEY });const session = await bb.sessions.create({ extensionId: 'your-extension-id'});console.log(`Session created with ID: ${session.id}`);
from browserbase import Browserbaseimport osbb = Browserbase(api_key=os.environ["BROWSERBASE_API_KEY"])session = bb.sessions.create( extension_id="your-extension-id")print(f"Session created with ID: {session.id}")
Starting a new session with an extension can increase the session creation
time. The browser must be restarted to load the extension, which itself has
nonzero load time.