BrowserSetAuthentication Function

Action

Sets username and password for a subsequent authentication attempt. Usually the username and password must be typed into an authentication dialog for authentication purposes. This function stores both strings temporarily so that they can be used for authentication with the following API call. The password string is never visible in the replay pane of the browser application nor shown by TrueLog Explorer.

注: This function only works with Internet Explorer.

Include file

BrowserAPI.bdh

Syntax

BrowserSetAuthentication( sUsername : in string,
                          sPassword : in string ): boolean;
Parameter Description
sUsername The username for a subsequent authentication attempt.
sPassword The password for a subsequent authentication attempt.

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
  begin 
    BrowserStart(BROWSER_MODE_DEFAULT, 800, 600);
    
    // set the authentication for the secure site
    BrowserSetAuthentication("BasicAuthUser", "BasicAuthPass");
    // navigate to the secure site
    BrowserNavigate("http://demo.borland.com/TestSite/secure_sub1/secure_authrequ.asp?LOGON_USER=BasicAuthUser");
  end TMain;