Docs/SDK/Downloads

Downloads

Track downloads and verify completion inside the verification loop (e.g., download_completed("report.csv") / downloadCompleted("report.csv")).

This page covers:

Downloads should be asserted, not assumed.

A browser agent can click “Download” and still fail to actually download the file. Treat downloads as a verifiable outcome.

Table of Contents

  1. What gets tracked
  2. Verification predicate
  3. Examples
  4. Debugging

What gets tracked

Download capture is best-effort and depends on backend support, but the runtime tries to record:

The goal is not “perfect file system introspection,” but a reliable signal you can use in assertions.


Verification predicate

Use the download predicate in a required assertion (or as a done gate).

from predicate import download_completed

# Gate step success on a specific file appearing as completed
runtime.assert(download_completed("report.csv"), "download_ok", required=True)

Examples

Verify a download after a click

from predicate import click, download_completed

runtime.begin_step("Download report")
snap = await runtime.snapshot(limit=80)

# (Find the download button your preferred way, then click it)
click(browser, element_id)

# Re-snapshot and verify the download finished
await runtime.snapshot()
runtime.assert(download_completed("report.csv"), "report_downloaded", required=True)

Debugging

If a download assertion fails: