Skip to main content

How do you test file uploads and downloads in browser automation?

  • file upload
  • file download
  • browser automation

Answer it first, then compare. Nothing here is saved or scored.

Model answer

Uploads: Use setInputFiles() in Playwright or Cypress attach_file. For drag-drop uploads, dispatch the drop event programmatically. Downloads: In Playwright, use page.waitForEvent("download"), then verify the file content. In Cypress, intercept the download URL and verify with cy.readFile. Verify both success UI and actual file content. Handle edge cases: large files, wrong file types, multiple files, cancelled uploads.

What interviewers listen for

  • Test architecture instincts
    You can defend why your suite is shaped like a pyramid, a trophy, or a honeycomb.
  • Locator discipline
    You rank selector strategies by stability and explain when to break the rule.
  • Flaky test ownership
    You debug to a structural fix instead of retry-until-green.
  • Parallelisation literacy
    You know how your framework isolates state, fixtures, and database access across workers.

See all 35 automation questions

Written by , Senior QA Automation Engineer, 50+ QA candidate interviews conductedLast updated July 2026