Wait Download
Awaits a timeout defined for download to be completed.
Command availability: IBM RPA SaaS and IBM RPA on premises
Script syntax
IBM RPA's proprietary scripting language has a syntax similar to other programming languages. The script syntax defines the command's syntax in the script file. You can work with this syntax in IBM RPA Studio's Script mode.
webWaitDownload [--saveto(String)] [--nametosave(String)] [--expectedfilename(String)] --extension(String) [--timeout(TimeSpan)] (String)=filename (Boolean)=success
Dependencies
Use the Start Browser (webStart
) command to start a browser or use the Find Internet Explorer Browser (findBrowser
) command
to attach the Microsoft Internet Explorer before using Wait Download (webWaitDownload
) command.
Input parameter
The following table displays the list of input parameters available in this command. In the table, you can see the parameter name when working in IBM RPA Studio's Script mode and its Designer mode equivalent label.
Designer mode label | Script mode name | Required | Accepted variable types | Description |
---|---|---|---|---|
Save to | saveto |
Optional |
Text |
Directory to save the file after downloading it. |
File name | nametosave |
Optional |
Text |
File name after downloading it. If you don't enter a name, the command automatically generates a random name for the downloaded file. |
Original file name | expectedfilename |
Optional |
Text |
Original file name which the command looks for to define whether the download was completed or not. |
File extension | extension |
Required |
Text |
Extension of the downloaded file. |
Timeout | timeout |
Optional |
Time Span, Number, Text |
Timeout to validate the download. |
Output parameter
Designer mode label | Script mode name | Accepted variable types | Description |
---|---|---|---|
File | filename |
Text |
Returns the path that stores the file after downloading. |
Success | success |
Boolean |
Returns True if the file was successfully downloaded, or False otherwise. |
Example
The following example shows the command waiting for the download of the Google Chrome browser installer.
defVar --name desktopPath --type String
defVar --name successDownload --type Boolean
defVar --name file --type String
// Use the desktop path to save the downloaded file.
getSpecialFolder --folder "Desktop" desktopPath=value
// Starts the browser Google Chrome
webStart --name browser --type "Chrome"
// Navigates to the Google web page.
webNavigate --url "https://www.google.com/?gl=us&hl=en&pws=0&gws_rd=cr"
// Look for Chrome, the example will download the installer for that browser.
webSet --value Chrome --selector "Name" --name q
webClick --selector "NameAndValue" --name btnI --elementvalue "I\'m Feeling Lucky"
webClick --selector "Id" --id "js-download-hero"
// As it is an executable, the extension is .exe
// Note that even if the file has a name, the name parameter is empty, so a random name is generated.
webWaitDownload --saveto "${desktopPath}" --extension ".exe" --timeout "00:01:00" file=filename successDownload=success
webClose --name browser
// The console displays the file name and if the download was completed.
logMessage --message "\r\n----------------\r\nFile: ${file}\r\n----------------\r\nSuccess: ${successDownload}" --type "Info"
Limitations
If the command is downloading two files simultaneously to the same folder, and both file names are not specified, the command only downloads one of the files.