BrowserFileDownload Function

Action

Reads a file from a certain location and stores it to the local file system. This call can only be scripted manually. The recorded function is the improved BrowserDlgDownload function.

Include file

BrowserAPI.bdh

Syntax

BrowserFileDownload( sUrl      : in string,
                     sFilename : in string optional,         
                     sTimer    : in string optional, 
                     nFilesize : out number optional ): boolean;
Parameter Description
sUrl The location of the file to be downloaded.
sFilename Optional: The name of the file (optionally including path) which shall be created on the local disk. If no path is specified, the file is stored in the current project folder.
sTimer Optional: The name of the timer used for page measurements. If this parameter is omitted, no measurements are performed.
nFilesize Optional: The size of the file.

Return value

  • true if successful

  • false otherwise

Example

benchmark SilkPerformerRecorder

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

dcluser
  user
    VUser
  transactions
    TInit           : begin;
    TMain           : 1;

var

dclrand

dcltrans
  transaction TInit
  begin
  end TInit;

  transaction TMain
  var
    javaScript : string;
  begin
    BrowserStart(BROWSER_MODE_DEFAULT, 800, 600);
    // start download of a file from the demo.borland.com site    
    BrowserFileDownload("http://demo.borland.com/TestSite/temp/SmallFile.exe", "SmallFile.exe", 
      "FileDownload SmallFile.exe (#1)");
  end TMain;