Skip to main content
Q&A

Best approach for testing file downloads in Playwright?

Ajitesh Mohanta
Ajitesh MohantaAmbassador
May 29, 2026 1,059 0
I need to test that a CSV export button downloads the correct file with the right data. Our app generates the file server-side and streams it. I've tried `page.waitForEvent('download')` and it works sometimes, but I'm not sure how to: - Assert on the file contents (not just that a download happened) - Handle cases where the download URL is a redirect chain - Make this reliable in headless CI Any patterns or utility functions you'd recommend?

No comments yet. Be the first to answer this question!

Join the discussion

Have something to add?

Sign in to reply, follow this thread, and earn XP when your answer helps someone.

Best approach for testing file downloads in Playwright? — QA Bash Community | QA Bash