Class DownloadOptions

java.lang.Object
com.codeborne.selenide.DownloadOptions
All Implemented Interfaces:
HasTimeout

public class DownloadOptions extends Object implements HasTimeout
  • Method Details

    • getMethod

      public @Nullable FileDownloadMode getMethod()
    • timeout

      public @Nullable Duration timeout()
      Specified by:
      timeout in interface HasTimeout
    • incrementTimeout

      public @Nullable Duration incrementTimeout()
    • getFilter

      public FileFilter getFilter()
    • getAction

      public DownloadAction getAction()
    • withMethod

      public DownloadOptions withMethod(FileDownloadMode method)
    • withTimeout

      public DownloadOptions withTimeout(long timeoutMs)
    • withTimeout

      public DownloadOptions withTimeout(Duration timeout)
    • withIncrementTimeout

      public DownloadOptions withIncrementTimeout(Duration incrementTimeout)
      Set increment timeout for downloading. If no changes in files will be detected during this period of time, the download will be concluded as failed.

      Currently, it's used only for FOLDER download method. It's reasonable to set increment timeout when 1. the download timeout is quite large (download might be very slow), and 2. there is a risk that the downloading process hasn't even started (click missed the link etc.) Then setting a shorter increment timeout allows you to fail faster.

      Parameters:
      incrementTimeout - should be lesser than download timeout
    • withFilter

      public DownloadOptions withFilter(FileFilter filter)
    • withExtension

      public DownloadOptions withExtension(String extension)
    • withName

      public DownloadOptions withName(String fileName)
    • withNameMatching

      public DownloadOptions withNameMatching(String fileNameRegex)
    • withAction

      public DownloadOptions withAction(DownloadAction action)
      User action to start the downloading process. By default, it's a click.

      Use this method if you need to close some alert before downloading file etc.

      Parameters:
      action - any lambda accepting a Driver and WebElement (the element being clicked).
      Returns:
      DownloadOptions
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • file

      public static DownloadOptions file()
    • using

      public static DownloadOptions using(FileDownloadMode method)