Skip to content

[Bug]: Page.goto throws "Download is starting" error when navigating to a direct download URL #3081

@rihuka

Description

@rihuka

Version

1.60.0

Steps to reproduce

Run the code:

from playwright.sync_api import sync_playwright

url = 'https://ams.download.datapacket.com/100mb.bin'
output_path = '100mb.bin'

with sync_playwright() as playwright:
    browser = playwright.chromium.launch(headless=False, args=['--start-maximized'], slow_mo=2000)
    context = browser.new_context(no_viewport=True)
    page = context.new_page()
    with page.expect_download(timeout=60000) as download_info:
        page.goto(url=url)
    download = download_info.value
    download.save_as(path=output_path)

Expected behavior

Download is completed.

Actual behavior

Exception has occurred: Error
Page.goto: Download is starting
Call log:

Additional context

If I enclose page.goto(url=url) within try-except (please see below), then no error occurs.

try:
    page.goto(url=url)
except:
    pass

Environment

- Operating System: [Windows 10 22H2]
- CPU: [x86-64]
- Browser: [Chromium]
- Python Version: [3.13.13]
- Other info:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions