playwright failed when agent tried downloading the hubspot contact view
Fixes Playwright downloads failing on HubSpot contact views: handle the download event properly and wait for completion. Use when automated downloads fail or produce empty files. Not for export API issues.
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
Playwright failed: download event never fired; the contact view export produced no file.Steps
- Set up the download listener before the click that triggers it. Expected: the event is captured.
- Click the export control. Expected: the download event fires.
- Wait for the download to complete (not just start). Expected: a complete file, not a partial.
- Save to a known path and verify the file size. Expected: a non-empty file.
- 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