BrowserDlgDownload Function


Creates a file download command in the dialog command storage. BrowserDlgDownload provides enhanced file download functionality and replaces the BrowserFileDownload function when recording new scripts. The actual file download is triggered by a subsequent call like BrowserClick.

BrowserDlgStop is required to synchronize and end the file download procedure. The default timeout is 20 seconds, which can be customized by using BrowserSetOption with the BROWSER_OPT_FILEDOWNLOAD_BEGIN_TIMEOUT option. If the download starts within the defined timeout, the execution of the script is blocked within BrowserDlgStop until the download has finished. If the download does not start within the specified time, the API call fails and returns an error.

Whether and how the file is copied from the browser cache to the local disk depends on the type of executed test run and/or on the BROWSER_OPT_FILEDOWNLOAD_SAVEFILE option defined in the BrowserSetOption call that needs to be scripted before the BrowserDlgDownload call. If the BROWSER_OPT_FILEDOWNLOAD_SAVEFILE option is not specified, all downloaded files are copied from the browser cache to the results directory for Try Script runs, and for load test runs and find baseline runs no files are copied to the results directory. It is recommended not to copy any files to the results directory for load test runs, as this could result in huge amounts of data being saved on the local disk, and this data will also need to be copied from the agent machines to the controller.

Note: This function only works with Internet Explorer.

Include file



BrowserDlgDownload( sFileName : in string ): boolean;
Parameter Description
sFilename The name of the file which shall be downloaded to the local disk. For recording, files are stored in the current project folder. For replay, files are stored in the project's results folder. The results folders are called RecentTryScriptRun for Try Script runs, the specified load test folder name for load tests, and RecentBaseLineTest for find baseline runs.

Return value

  • true if successful

  • false otherwise


benchmark SilkPerformerRecorder

use "Kernel.bdh"
use "BrowserAPI.bdh"

    TMain           : 1;

  transaction TMain
    wnd1 : number;
    BrowserStart(BROWSER_MODE_DEFAULT, 800, 600);
      "Navigate_ (#1)");
    wnd1 := BrowserGetActiveWindow("wnd1");
    BrowserClick("//A[@textContents='Small File']", BUTTON_Left, "Click, A, textContents=Small File (#1)");
  end TMain;