BrowserDlgStop Function

Action

Clears the content of the dialog command storage and closes any open pop-up dialog boxes. This is necessary for clearing unused dialog commands. This should be done immediately after an API call evokes the opening of a dialog.

BrowserDlgStop is also required for synchronization of file downloads and should not be manually removed from a script. It is used to synchronize and end the file download procedure. If a file download command was initiated by BrowserDlgDownload or BrowserDlgCancel and triggered by a call such as BrowserClick, the execution of BrowserDlgStop waits until the download starts. 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.

Include file

BrowserAPI.bdh

Syntax

BrowserDlgStop(): boolean;

Return value

  • true if successful

  • false otherwise

Example

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");
    BrowserDlgDownload("SmallFile.exe");
    BrowserClick("//A[@textContents='Small File']", BUTTON_Left, "Click, A, textContents=Small File (#1)");
    BrowserDlgStop();
  end TMain;