diff --git a/packages/docs/v3/configuration/browser.mdx b/packages/docs/v3/configuration/browser.mdx index f3c3916d2..2b43227aa 100644 --- a/packages/docs/v3/configuration/browser.mdx +++ b/packages/docs/v3/configuration/browser.mdx @@ -186,6 +186,7 @@ const stagehand = new Stagehand({ devtools: true, // Open developer tools viewport: { width: 1280, height: 720 }, executablePath: '/opt/google/chrome/chrome', // Custom Chrome path + port: 9222, // Fixed CDP debugging port args: [ '--no-sandbox', '--disable-setuid-sandbox', @@ -214,6 +215,27 @@ await stagehand.init(); ## Advanced Configuration +### Fixed CDP Debugging Port + +Specify a fixed Chrome DevTools Protocol (CDP) debugging port instead of using a randomly assigned one. + +```typescript +import { Stagehand } from "@browserbasehq/stagehand"; + +const stagehand = new Stagehand({ + env: "LOCAL", + localBrowserLaunchOptions: { + port: 9222, + }, +}); + +await stagehand.init(); +``` + + +If no `port` is specified, a random port will be assigned. + + ### DOM Settle Timeout Configure how long Stagehand waits for the DOM to stabilize before taking actions. diff --git a/packages/docs/v3/references/stagehand.mdx b/packages/docs/v3/references/stagehand.mdx index 692690155..c3481aae5 100644 --- a/packages/docs/v3/references/stagehand.mdx +++ b/packages/docs/v3/references/stagehand.mdx @@ -115,6 +115,12 @@ interface V3Options { Path to Chrome/Chromium executable. + + Fixed Chrome DevTools Protocol (CDP) debugging port for external tool connections. + + **Default:** Randomly assigned + + Additional Chrome launch arguments.