Augment your browser sessions with your own Chrome extensions.
For applications requiring enhanced functional capabilities, providing your own
Chrome extension is a great option. With Browserbase, using extensions is easy.
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 smaller than 4.5 MB.
To use your extension, create a new session with the extension enabled:
from browserbase import Browserbasebb = Browserbase(api_key="your-api-key")# Create a session with the extensionsession = bb.sessions.create( project_id="your-project-id", extension_id="your-extension-id")print(f"Session created with ID: {session.id}")
from browserbase import Browserbasebb = Browserbase(api_key="your-api-key")# Create a session with the extensionsession = bb.sessions.create( project_id="your-project-id", extension_id="your-extension-id")print(f"Session created with ID: {session.id}")
import { Browserbase } from '@browserbasehq/sdk';const bb = new Browserbase('your-api-key');// Create a session with the extensionconst session = await bb.sessions.create({ projectId: 'your-project-id', extensionId: 'your-extension-id'});console.log(`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.