Download-File
Command Description
Use a browser to download files from a specified link
Command Prototype
WebBrowser.Download(hWeb,sURL,sFile,bSync,iTimeOut,optionArgs)
Parameter Description
Parameter | Required | Type | Default | Description |
---|---|---|---|---|
hWeb | True | expression | hWeb | Browser handle string using WebBrowser.create or WebBrowser.bind Command Returns |
sURL | True | string | "" | The link address (URL) to download file |
sFile | True | path | '''C:\Users''' | The path to save the downloaded file locally |
bSync | True | boolean | True | The command is run synchronously, and then returns to TRUE and wait for the file download to return to continue, transfer to false, then return to return immediately after downloading |
iTimeOut | True | number | 300000 | The timeout for the file to be downloaded. If it expires, it is determined that the download fails. The default time is 300000 milliseconds (5 minutes) |
bContinueOnError | None | boolean | None | Specify whether the automation should continue to support this field even if the activity is incorrect, it is only supported by the Boolean value (true, false) default value |
iDelayAfter | None | number | 300 | Delay time (in milliseconds) after executing the activity is 300 milliseconds |
iDelayBefore | None | number | 200 | The delay time (in milliseconds) before any operations are executed is by default 200 milliseconds |
Demo
/*********************************download file************** ************************
Command prototype:
WebBrowser.Download(hWeb,sURL,sFile,bSync,iTimeOut,optionArgs)
Input parameters:
hWeb--Browser object
sURL--the link address (URL) of the file to be downloaded
sFile--path where the downloaded file is saved on this computer
bSync--Whether the command is executed synchronously
iTimeOut--timeout time for waiting for file download
bContinueOnError--whether to continue after error
iDelayAfter-- delay after execution
iDelayBefore--delay before execution
*********************************************************************************/
Dim hWeb,bRet
hWeb = WebBrowser.Create("ie","www.baidu.com",30000,{"bContinueOnError":false,"iDelayAfter":300,"iDelayBefore":200,"sBrowserPath":"","sStartArgs":""})
TracePrint(hWeb)
hWeb = WebBrowser.BindBrowser("ie",10000,{"bContinueOnError":false,"iDelayAfter":300,"iDelayBefore":200})
TracePrint(hWeb)
iRet = WebBrowser.GoURL(hWeb,"https://laiye.com/download?source=product-process-creator-banner",false,{},30000,{"bContinueOnError":false,"iDelayAfter":300,"iDelayBefore":200})
TracePrint(iRet)
WebBrowser.Download(hWeb,"https://down.uibot.com.cn/onekernel/6.0.0/UiBot_Community_Official_X86_V6.0.0_2021.12.15.2018.exe",'''C:\Users\Downloads''',true,60000,{"bContinueOnError":false,"iDelayAfter":300,"iDelayBefore":200})