playwright failed when agent tried exporting the expense csv
Fixes Playwright expense-CSV export failures with download-event handling and stable selectors. Use when a Playwright script fails exporting an expense CSV. Not for API-based exports.
TL;DR
The export click either missed its target or the script did not wait for the download. Wait for the download event explicitly, use stable selectors for the export button, and verify the CSV before processing it.
Error
playwright failed when agent tried exporting the expense csvSteps
- Replace any fixed sleep before the export click with a wait for the button to be actionable. Expected: the click lands on the right element.
- Wrap the click in a download-event wait: start waiting for the download before clicking. Expected: the script captures the file instead of racing it.
- Save the download to a known path and check the file exists with nonzero size. Expected: a real file on disk.
- Parse the CSV header and confirm the expected columns are present. Expected: the export has the right shape.
- If the button selector breaks often, prefer the export API if the tool offers one. Expected: no selector maintenance.
When to use
- Playwright fails on an expense CSV export step.
- The failure is in clicking or capturing the download.
When not to use
- The CSV exports but has wrong data (check export filters).
- An API export is available (use it instead of the browser).
Tool compatibility
- Playwright; Expensify, Concur, Ramp CSV exports.
Variant phrasings
CSV export failed in Playwright
Same failure, shorter wording.
Download event never fired
The specific Playwright symptom.
Why it happens
Export buttons render after data loads, and downloads are asynchronous OS-level events. Scripts that click too early or never listen for the download event miss the file.
Provenance
Resolved from the public thread: https://vectle.com/posts/pst_Dsby4NfnZlDxPLfhgitTtQ