Skip to content

browserbase/playbook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎭 Browserbase Playbook

A comprehensive collection of code examples for using Browserbase across different languages and automation frameworks.

What is Browserbase?

Browserbase provides cloud browser infrastructure for reliable web automation. This playbook demonstrates how to use Browserbase with various languages and frameworks to:

  • Run browser automation in the cloud
  • Implement stealth and anti-bot features
  • Manage browser sessions and contexts
  • Handle downloads, uploads, and screenshots
  • Configure proxies and captcha solving

Setup Instructions

Prerequisites

  • Node.js 18+ (for JavaScript/TypeScript examples)
  • Python 3.8+ (for Python examples)
  • A Browserbase account with API key and project ID (Sign up here)

Installation

  1. Clone this repository:

    git clone https://github.com/browserbase/playbook.git
    cd playbook
  2. Install dependencies for your preferred language:

    JavaScript/TypeScript:

    npm install

    Python:

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
    pip install -r requirements.txt
  3. Set up your environment variables:

    cp .env.example .env

    Then edit the .env file with your credentials:

    BROWSERBASE_PROJECT_ID=your_project_id
    BROWSERBASE_API_KEY=your_api_key
    OPENAI_API_KEY=your_openai_key  # Optional, used for Stagehand
    ANTHROPIC_API_KEY=your_anthropic_key  # Optional, used for Stagehand
    

Running Examples

Find utility functions for managing Browserbase in:

  • node/functions.ts (TypeScript)
  • python/functions.py (Python)

Node.js:

npx tsx path/to/example.ts

Python:

python path/to/example.py

Troubleshooting

  • Connection Issues: Check your API key and network connection
  • Session Timeouts: Configure longer timeouts or enable keep-alive
  • Captcha Problems: Review captcha configuration in session settings
  • Proxy Errors: Verify proxy settings and availability

For more help, visit the Browserbase Documentation or contact support at [email protected].

Additional Resources

About

Collection of templates, guides, and best practices to help you get the most out of Browserbase.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •