[feat]: forward `ignoreDefaultArgs` to chrome-launcher

Merged
SE
6mo ago
+256-64

thanks @CalebBarnes for the contribution! (original PR: #2074)

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 so you can drop all or selected default flags from chrome-launcher with exact-match control (including Stagehand defaults), while keeping your own args.

  • New Features
    • Added ignoreDefaultArgs to LaunchLocalOptions and moved flag assembly into launchLocalChrome(), forwarding to chrome-launcher via ignoreDefaultFlags.
    • true drops all chrome-launcher defaults; string[] removes only exact-matched defaults and re-adds the rest from Launcher.defaultFlags(). Stagehand defaults and user args stay unless explicitly listed.