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:

members only

Keep reading with the full course

The Foundations track and the first 5 lectures of each framework are free. This lecture is part of the paid course, which unlocks every lecture, all three frameworks, and downloads.

See the options →