Skip to content

[Feature Parity] dont close new opened tabs #131

Open
@stagehand-parity-bot

Description

@stagehand-parity-bot

Feature Parity Request

This issue was automatically created from a pull request in the TypeScript Stagehand repository that was labeled with 'parity'.

Original PR Details

Description

why

  • when a new tab is opened, we call page.goto() with the URL of the new tab, and immediately close the old tab
  • this is problematic, because on some websites you are required to keep the old tab open in order to continue browsing in the new tab
  • this PR removes that behaviour: we no longer close tabs implicitly

what changed

  • added a live page proxy in index.ts which always points to the focused page/tab
  • added a listener in StagehandContext.ts which listens for new pages, and initializes them as Stagehand pages
    • this means that you can call act/extract/observe on all open pages, even if they are not the focused page
  • preserved expected behaviour when users define const page = stagehand.page and then use page throughout their code, they expect page to always point to the "focused" page

test plan

  • added two new act evals that open & close tabs
  • run act, regression and combination evals

Changed Files

  • .changeset/little-hornets-tan.md
  • evals/deterministic/tests/BrowserContext/multiPage.test.ts
  • evals/evals.config.json
  • evals/evaluator.ts
  • evals/tasks/agent/kayak.ts
  • evals/tasks/multi_tab.ts
  • evals/tasks/tab_handling.ts
  • lib/StagehandContext.ts
  • lib/StagehandPage.ts
  • lib/handlers/agentHandler.ts
  • lib/handlers/handlerUtils/actHandlerUtils.ts
  • lib/index.ts

Recent Comments

@changeset-bot[bot] commented:

🦋 Changeset detected

Latest commit: 5ae360defeb66061e8012c259988901c6bc08e86

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

[Click here if you're a maintainer who wants to add another changeset to this PR](https://github.com/browserbase/stagehand/new/dont-close-new-tabs?filename=.changeset/flat-tables-sip.md&value...

Action Required

Please review the changes in the original PR and implement equivalent functionality in the Python SDK if applicable.


This issue was automatically generated by the Feature Parity workflow.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions