Skip to content

Conversation

shubh24
Copy link
Contributor

@shubh24 shubh24 commented Aug 19, 2025

why

Downloads were not working properly in use_api=false mode when using Playwright with CDP (Chrome DevTools Protocol). The browser's default download behavior was not configured, causing downloads to fail or be blocked. This change adds proper CDP configuration to enable downloads, matching the behavior already implemented in the TypeScript version of Stagehand.

what changed

  • Added CDP download behavior setup in BROWSERBASE mode after browser connection
  • Uses Chrome DevTools Protocol to send Browser.setDownloadBehavior command with:
    • behavior: "allow" to enable downloads
    • downloadPath set to the configured or default path
    • eventsEnabled: true for download event tracking

@shubh24
Copy link
Contributor Author

shubh24 commented Aug 19, 2025

This isn't yet tested!

@miguelg719
Copy link
Collaborator

A changeset would be great! try uvx changeset

@shubh24 shubh24 changed the title Draft: Fixing downloads behavior for env=LOCAL setup Draft: Fixing downloads behavior for use_api=false Aug 19, 2025
@shubh24 shubh24 changed the title Draft: Fixing downloads behavior for use_api=false Fixing downloads behavior for use_api=false Aug 19, 2025
@shubh24
Copy link
Contributor Author

shubh24 commented Aug 19, 2025

This isn't yet tested!

Tested now, works for this config!

    config = StagehandConfig(
        env="BROWSERBASE",
        browserbase_session_id=session_id,
        ...
        use_api=False,
    )

@miguelg719 miguelg719 merged commit 6f72281 into main Aug 19, 2025
13 checks passed
@github-actions github-actions bot mentioned this pull request Aug 19, 2025
@miguelg719
Copy link
Collaborator

closes #130

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants