Package org.openqa.selenium
Interface HasDownloads
- All Known Implementing Classes:
ChromeDriver,ChromiumDriver,EdgeDriver,FirefoxDriver,InternetExplorerDriver,RemoteWebDriver,SafariDriver
public interfaceHasDownloads
Indicates that a driver supports downloading remote files.
Nested Class Summary
Nested ClassesMethod Summary
Modifier and TypeMethodDescriptionvoidDeletes the downloadable files.voiddownloadFile(String fileName,Path targetLocation) Downloads a file to a given location.Deprecated.Use methodgetDownloadedFiles()insteadGets all files downloaded by browser.booleanChecks if downloads are enabledstatic booleanisDownloadsEnabled(Capabilities capabilities) default voidrequireDownloadsEnabled(Capabilities capabilities) Requires downloads to be enabled.
Method Details
requireDownloadsEnabled
Requires downloads to be enabled.TODO: Create an example in the documentation and provide a link to it.
- Parameters:
capabilities- the capabilities object- Throws:
WebDriverException- if capability to enable downloads is not set
isDownloadsEnabled
boolean isDownloadsEnabled()Checks if downloads are enabled- Returns:
- true if this webdriver has capability "se:downloadsEnabled" = true
isDownloadsEnabled
getDownloadableFiles
Deprecated.Use methodgetDownloadedFiles()insteadGets the downloadable files.- Returns:
- a list of downloadable files for each key
getDownloadedFiles
List<HasDownloads.DownloadedFile> getDownloadedFiles()Gets all files downloaded by browser.- Returns:
- a list of files with their name, size and time.
downloadFile
Downloads a file to a given location.- Parameters:
fileName- the name of the file to be downloadedtargetLocation- the location where the file will be downloaded to- Throws:
IOException- if an I/O error occurs while downloading the file
deleteDownloadableFiles
void deleteDownloadableFiles()Deletes the downloadable files.