Download Manager component
Use the Download Manager component to track when downloads start, stop, and fail in your automation, to take the appropriate next action.
In attended implementations, the project should be running and the adapter should be started before a download starts. The following scenarios are examples:
- If a download starts before the adapter starts, and the adapter finishes before another download starts, no DownloadCompleted event fires.
- If a download starts before the adapter starts, and then the download pauses, resumes, and finishes, only the DownloadResumed event and any events that come after it are executed.
Use the following properties, methods, and events when downloading files from the Google Chrome or Microsoft Edge browsers using the Download Manager component.
Properties
Property | Description | Return type |
IsDownloading | Indicates whether any files are currently in the process of downloading. For example, if a download is in progress, this property equals True. If no downloads are in progress, the property equals False. | Boolean |
Items | The list of the Download Item objects that you can access by using the Download API. Robot Studio retrieves this list from the browser. | Download Item object array |
ItemsCount | The number of Download Item objects that are in the Items array. | Integer |
Methods
Method | Description | Parameters | Return type |
CancelDownload | Use this method to stop a download. Specify the download that you want to stop using the downloadID parameter. | downloadID (Integer) | Void |
ClearAllItemsFromList | Use this method to clear all the items from the download
list. The system does not delete the file from the disk. For more information, see FileUtils component. | None | Void |
ClearItemFromList | Use this method to clear a specific file download from the list. Specify the download that you want to remove using the downloadID parameter. The system does not delete the file from the disk. For more information, see FileUtils component. | downloadID (integer) | Void |
ClearItemsFromList | Use this method to clear all the items added between the times specified in the fromDateTime and toDateTime parameters from the download list. To clear all downloads from the list before the toDateTime, leave the fromDateTime parameter blank. To clear all downloads from the list after the fromDateTime, leave the fromDateTime parameter blank. | fromDateTime toDateTime | Void |
GetDownloadDetails | Use this method to return all the available information provided for the downloadID that you specify. The details include information that is stored in the following properties:
| downloadID (integer) | See property discussions for individual return types. |
PauseDownload | Use this method to pause a download. Specify the download that you want to pause by using the downloadID parameter. | downloadID (integer) | Void |
ResumeDownload | Use this method to resume the downloading of a file. Specify the download that you want to resume by using the downloadID parameter. | downloadID (integer) | Void |
ResumeDownloads | Use this method to resume all interrupted downloads that you specified in the fileList parameter. Use the resumeAttempts parameter to specify how many additional times the system should try to download each file. For example, if you enter three (3), the system tries to restart the download four (4) times. If you do not specify the number of attempts, the system tries to resume the download only once. There are no timeouts or pauses between attempts. The system stops processing this method after it finishes processing all interrupted files and all files on the list to download, or after the timeout interval is met, whichever occurs first. The timeout parameter defaults to 30000 milliseconds. The system returns one of the following statuses:
The system expects files that are still downloading when the timeout interval expires to complete on their own. The FileList input parameter contains the list of objects to be evaluated and resumed. FileList is also an output that returns the current state of all files in the list. | ||
WaitForDownloads | Use this method to accumulate a list of downloads, starting when the system begins to execute the block and continuing until the downloadStartTime interval expires. During this time interval, the system adds any downloads that are initiated to the FileList. Setup actions occur on an asynchronous thread that triggers the download. The system only allows one WaitForDownloads method to be within the downloadStartTime interval at a time. This means that if two automations call the WaitForDownloads method at the same time, the second method call will not proceed until the downloadStartTime interval on the first call finishes. This helps to confine the FileList associated with the method call to only the files downloaded by the setup action. The system returns one of the following statuses:
The system expects files that are still downloading when the timeout interval expires to complete on their own. Use the downloadStartTime parameter to specify, in milliseconds, how long to wait for downloads to start. The default is 5000 milliseconds. Use the timeout parameter to specify, in milliseconds, the maximum amount of time to wait for a download to appear on the FileList. The default is 30000 milliseconds. The FileList parameter contains the list of objects that began downloading while the block was in the downloadStartTime interval. In an attended automation, if the user manually starts a download within the downloadStartTime interval, that download is also added to the list. Pass the FileList into a list loop and create a proxy to get download item information. |
Events
Event | Description |
DownloadCancelledEvent | This event fires when a download is cancelled. Returns the downloadID, the Download Item object, and the Filepath. |
DownloadCompleted | This event fires when a download completes. Returns the downloadID, the Download Item object, and the Filepath. |
DownloadInterrupted | This event fires when a download is interrupted. Returns the downloadID, the Download Item object, and the Filepath. |
DownloadPausedEvent | This event fires when a download pauses. Returns the downloadID, the Download Item object, and the Filepath. |
DownloadResumed | This event fires when a download resumes. Returns the downloadID, the Download Item object, and the Filepath. |
DownloadStarted | This event fires when a download starts. Returns the downloadID, the Download Item object, and the Filepath. |
DownloadStatusChanged | This event fires when a download status changes. Returns the downloadID, the Download Item object, the Filepath, the PriorStatus (none, started, paused, interrupted, canceled, and so on), and the current Status. |
Previous topic Download Manager Next topic Download Item object