lecture 12 of 180 completed

File uploads and downloads

The file dialog belongs to the operating system, so no tool can click it. Playwright gives you a way around that for both directions.

What you'll learn

  • How to attach a file without touching the file dialog
  • Why the listener must start before the click
  • What to assert after an upload or download

Import a CSV, export an invoice, attach a document. Almost every business app does both, and both are awkward to test for the same reason: the file picker is an operating system window, not part of the page. No browser automation tool can click it.

Uploads.

You attach the file to the input directly:

full course

Keep reading with the full course

The Foundations track and the first lessons in each framework are free. This lesson needs full course access. A course plan includes all lessons for Playwright, Cypress and Selenium.

See course plans →