Class DownloadOptions

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

@ParametersAreNonnullByDefault public class DownloadOptions extends Object implements HasTimeout
  • Method Details

    • getMethod

      @CheckReturnValue @Nonnull public FileDownloadMode getMethod()
    • timeout

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

      @CheckReturnValue public Duration incrementTimeout()
    • getFilter

      @CheckReturnValue @Nonnull public FileFilter getFilter()
    • getAction

      @CheckReturnValue @Nonnull public DownloadAction getAction()
    • withTimeout

      @CheckReturnValue @Nonnull public DownloadOptions withTimeout(long timeoutMs)
    • withTimeout

      @CheckReturnValue @Nonnull public DownloadOptions withTimeout(Duration timeout)
    • withIncrementTimeout

      @CheckReturnValue @Nonnull 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

      @CheckReturnValue @Nonnull public DownloadOptions withFilter(FileFilter filter)
    • 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
      Since:
      5.22.0
    • toString

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

      @CheckReturnValue @Nonnull public static DownloadOptions using(FileDownloadMode method)