BrowserStart Function

Action

BrowserStart is used to start the browser and also to manage virtual user behavior. There are two types of VUsers: Revisiting users and first time users. For first time users, the browser state (cookies, cache, and history) is cleared on each call to BrowserStart. Revisiting users reuse persistent session information.

Note: BrowserReset also resets the browser state.

Include file

BrowserAPI.bdh

Syntax

BrowserStart( nMode : in number optional,
              nHRes : in number optional,
              nVRes : in number optional,
              nXPos : in union optional,
              nYPos : in union optional ): boolean;
Parameter Description
nMode Optional: Configures virtual user behavior and browser visibility. The following constants may be used:
  • BROWSER_MODE_DEFAULT: Uses the profile settings.
  • BROWSER_MODE_DISPLAY_VISIBLE: Shows the browser window of each virtual user.
  • BROWSER_MODE_DISPLAY_INVISIBLE (default): Runs the browsers of the virtual users in hidden mode (does not apply for Try Script runs).
  • BROWSER_MODE_USERBEHAVIOR_DISABLE: Disables resetting the browser at end of transaction.
  • BROWSER_MODE_USERBEHAVIOR_FIRST_TIME: Clears virtual user browser state. Overrides the profile settings.
  • BROWSER_MODE_USERBEHAVIOR_REVISITING: Resets the non-persistent session, but does not delete the persistent cookies, cache, and history. Overrides the profile settings.
nHRes Optional: The width of the browser window. If this parameter is not specified, the system defaults are used.
nVRes Optional: The height of the browser window. If this parameter is not specified, the system defaults are used.
nXPos Optional: The X-position of the browser on the screen. If this parameter is not specified, the system defaults are used.
nYPos Optional: The Y-position of the browser on the screen. If this parameter is not specified, the system defaults are used.

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
    options : number;
   begin     
    // you can set multiple mode options by logically disjunctioning them.
    options := BROWSER_MODE_DISPLAY_VISIBLE | BROWSER_MODE_USERBEHAVIOR_FIRST_TIME;
    
    // start the browser with given options and a width of 480 and a height of 320 pixels
    BrowserStart(options, 480, 320); 
  end TMain;