Selenium WebDriver 4

Upload a single file

Medium70 pts~25 min
  • File upload
  • sendKeys
Practice app · Document Vault

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

Test URL
/lab/selenium-upload-a-single-file

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

Objective

Upload a file through the single file input without touching the operating system dialog.

Your task

  1. 1Create a temporary file named tqa-upload.txt with any text content.
  2. 2Send its absolute path to #file-upload with sendKeys.
  3. 3Click #upload-button.
  4. 4Assert #uploaded-files lists exactly one item containing “tqa-upload.txt”.

Acceptance criteria

  • The path is sent with sendKeys
  • #uploaded-files lists tqa-upload.txt
  • At least 1 assertion passes

Selenium WebDriver 4 · Selenium · Files, windows & storage