[fix]: attach to manually-created new tabs

Merged
SE
8mo ago
+81-4

why

  • when a user created a new tab by clicking the "+" icon in a headful chromium browser, stagehand would not attach to it, because it filtered out the "chrome://newtab" url pattern

what changed

  • extended the conditional in isNonWebTarget() to allow for "chrome://newtab" URLs to pass through, so that stagehand can attach to them Screenshot 2026-03-30 at 4 00 48 PM

test plan

  • added a test which creates a newtab target, & confirms that a new page object gets created

Summary by cubic

Fixes @browserbasehq/stagehand not attaching to tabs opened via the "+" button in Chromium by tracking chrome://newtab/ page targets so a page is created and becomes usable after navigation.

  • Bug Fixes
    • Updated isNonWebTarget() to always track top-level page targets, even with non-web schemes like chrome://newtab/.
    • Added Playwright tests to verify chrome://newtab/ tabs appear in pages() and work after navigating to a web URL.