Selenium WebDriver 4

Verify a file download

Hard120 pts~45 min
  • File download
  • Browser preferences
  • File system
Practice app · Document Vault

File upload and download, cookies, localStorage, sessionStorage and JavaScript execution.

Test URL
/lab/selenium-verify-a-file-download

Your starter code already declares TEST_URL — never hardcode a host.

Objective

Download the CSV report into a known folder and verify the file on disk, not just the UI message.

Your task

  1. 1Configure the browser download directory to a temporary folder (Chrome prefs download.default_directory, no prompt).
  2. 2Click #download-report and assert #download-status reads “Downloaded report.csv”.
  3. 3Poll until report.csv exists and no partial (.crdownload) file remains.
  4. 4Assert the first line is “id,document,owner,status,updated” and the file has 6 lines; delete it afterwards.

Acceptance criteria

  • The downloaded file is checked on disk
  • #download-status shows “Downloaded report.csv”
  • At least 2 assertions pass

Selenium WebDriver 4 · Selenium · Files, windows & storage