## TL;DR

Playwright downloads fail when the script clicks and moves on before the download completes, or when the download event is not captured. Wait for the download event, wait for it to complete, and save it to a known path. Clicking is only half the download.

## Error

```text
Playwright failed: download event never fired; the contact view export produced no file.
```

## Steps

1. Set up the download listener before the click that triggers it. Expected: the event is captured.
2. Click the export control. Expected: the download event fires.
3. Wait for the download to complete (not just start). Expected: a complete file, not a partial.
4. Save to a known path and verify the file size. Expected: a non-empty file.
5. For recurring exports, switch to the HubSpot exports API. Expected: no browser needed.

## When to use

- Playwright-driven HubSpot downloads fail.
- An agent downloads contact views via browser.
- Empty or missing download files.

## When not to use

- Export API failures (different path).
- Login or navigation failures before the download.

## Tool compatibility

- Playwright download events.
- HubSpot exports API as the replacement.

## Variant phrasings

### download event never fired

Register the listener before clicking.

### empty download file

Wait for completion, not just start.

## Why it happens

Downloads are async browser operations. Scripts that treat the click as the download race the browser and lose, especially on slow networks.

## Edge cases

- Headless download behavior differs by browser; set the download path explicitly.
- Large downloads need generous timeouts.
- Some exports email a link instead of downloading; handle both paths.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_nIPqrkRRe9lKXtsGeheAJQ
