Heuristic:SeleniumHQ Selenium Warning Deprecated HasDownloads GetDownloadableFiles
| Knowledge Sources | |
|---|---|
| Domains | WebDriver, Deprecation |
| Last Updated | 2026-02-12 01:30 GMT |
Overview
Deprecation warning: the getDownloadableFiles() method on the HasDownloads interface is deprecated. Use getDownloadedFiles() instead.
Description
The method HasDownloads.getDownloadableFiles() has been marked @Deprecated in the Selenium source code. This method returns a simple List<String> of file names. The replacement method getDownloadedFiles() returns a List<DownloadedFile> which provides richer metadata including file name, size, creation time, and last modified time.
Usage
This warning applies when you encounter code that calls getDownloadableFiles() on a driver cast to HasDownloads. Replace these calls with getDownloadedFiles() and update any code that processes the results to work with DownloadedFile objects instead of plain strings.
The Insight (Rule of Thumb)
- Action: Replace getDownloadableFiles() with getDownloadedFiles().
- Value: The new method returns List<DownloadedFile> with name, size, creation time, and modification time.
- Trade-off: Minor code change needed to handle DownloadedFile objects instead of String objects.
Reasoning
The original method only returned file names as strings. The replacement provides structured metadata (file size, timestamps) that enables more robust download verification in test automation, such as checking file sizes or verifying download completion by comparing timestamps.