Interface HasDownloads

All Known Implementing Classes:
ChromeDriver, ChromiumDriver, EdgeDriver, FirefoxDriver, InternetExplorerDriver, RemoteWebDriver, SafariDriver

public interface HasDownloads
Indicates that a driver supports downloading remote files.
  • Method Details

    • requireDownloadsEnabled

      default void requireDownloadsEnabled(Capabilities capabilities)
      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

      static boolean isDownloadsEnabled(Capabilities capabilities)
    • getDownloadableFiles

      @Deprecated List<String> getDownloadableFiles()
      Deprecated.
      Use method getDownloadedFiles() instead
      Gets 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

      void downloadFile(String fileName, Path targetLocation) throws IOException
      Downloads a file to a given location.
      Parameters:
      fileName - the name of the file to be downloaded
      targetLocation - 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.