Skip to main content

Documentation Index

Fetch the complete documentation index at: https://stagehand-shrey-check-v3-metrics-docs.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

User Data Directory

Persist browser data between sessions using a custom user data directory:
import { Stagehand } from "@browserbasehq/stagehand";

// For Browserbase sessions
const stagehand = new Stagehand({
  env: "BROWSERBASE",
  browserbaseSessionCreateParams: {
    userDataDir: "/path/to/user/data/directory",
  },
});

// For Local sessions
const localStagehand = new Stagehand({
  env: "LOCAL",
  localBrowserLaunchOptions: {
    userDataDir: "./browser-data",
  },
});

await stagehand.init();
console.log("Session ID:", stagehand.sessionId);