feat: forward ignoreDefaultArgs to chrome-launcher

Merged
CA
6mo ago
+243-1

why

When running Stagehand locally, chrome-launcher adds its own set of default flags (e.g. --disable-extensions). There's currently no way for consumers to selectively remove these flags — localBrowserLaunchOptions.chromeFlags can only add flags, not remove chrome-launcher's built-in defaults.

This is needed when users want to run Chrome with extensions enabled, or need to remove other chrome-launcher defaults for their use case.

what changed

  • Added ignoreDefaultArgs option to LaunchLocalOptions in local.ts
  • Forwarded localBrowserLaunchOptions.ignoreDefaultArgs from v3.ts through to launchLocalChrome()
  • When true: drops all chrome-launcher defaults (only Stagehand's own flags and user-supplied chromeFlags are used)
  • When string[]: selectively removes only the listed flags from chrome-launcher defaults, keeping the rest

This mirrors the behavior of Playwright's ignoreDefaultArgs option.

test plan

  • Verified locally that setting ignoreDefaultArgs: ["--disable-extensions"] successfully removes the flag from the launched Chrome instance (confirmed via chrome://version/)
  • Verified that other chrome-launcher defaults are preserved when using the array form
  • Verified that ignoreDefaultArgs: true drops all chrome-launcher defaults

Summary by cubic

Adds ignoreDefaultArgs to local Chrome launch and forwards it to chrome-launcher so users can drop all or selected default flags while keeping Stagehand and user flags.

  • New Features
    • Added ignoreDefaultArgs to LaunchLocalOptions and wired it through V3 to launchLocalChrome(), mapping to chrome-launcher’s ignoreDefaultFlags.
    • true drops all chrome-launcher defaults; string[] removes only exact-matched defaults and re-adds the rest from Launcher.defaultFlags(), preserving Stagehand defaults and user chromeFlags.