Adds a download command to the dialog command storage that checks the size of the downloaded file. The file to be downloaded must be declared beforehand with the BrowserDlgVerifyDownloadSize function. The function must be called before the download starts. Multiple verifications can be applied to a single download command to ensure that the resulting file size lies in between certain bounds. During recording, you can add a BrowserDlgVerifyDownloadSize function by checking the Verify size of download checkbox in the save file dialog.
BrowserAPI.bdh
BrowserDlgVerifyDownloadSize( in uExpectedSize : number, in nOptions : number optional := VERIFY_SIZE_EQUAL, in nSeverity : number optional := SEVERITY_ERROR ): boolean;
true if successful
false otherwise
Parameter | Description |
---|---|
uExpectedSize | The file size used for the verification |
nOptions | Describes how the actual size is compared to the expected size:
If this parameter is omitted, a check for equality is performed. |
nSeverity | Optional: Severity of the error that is raised if the verification fails. Can be one of the following values:
|
benchmark SilkPerformerRecorder use "Kernel.bdh" use "BrowserAPI.bdh" dcluser user VUser transactions TMain : 1; dcltrans transaction TMain var wnd1 : number; begin BrowserStart(BROWSER_MODE_DEFAULT, 800, 600); BrowserNavigate("http://demo.borland.com/TestSite/common_main.asp#Download", "Navigate_http://demo.borland.com/TestSite/common_main.asp#Download (#1)"); wnd1 := BrowserGetActiveWindow("wnd1"); BrowserSetOption(BROWSER_OPT_FILEDOWNLOAD_SAVEFILE, FILEDOWNLOAD_SAVEFILE_SAVELAST); BrowserDlgDownload("SmallFile.exe"); BrowserDlgVerifyDownloadSize(200, VERIFY_SIZE_LARGER_THAN | VERIFY_SIZE_EQUAL); // actual file must contain 200 Bytes or more BrowserClick("//A[@textContents='Small File']", BUTTON_Left, "Click, A, textContents=Small File (#1)"); BrowserDlgStop(); end TMain;