BrowserSetPassword Function

Action

Sets the password of a text field or text area element. This function is equivalent to the BrowserSetText function except that the password string is never visible in the replay pane of the browser application or shown by TrueLog Explorer.

Include file

BrowserAPI.bdh

Syntax

BrowserSetPassword( uTestObject           : in union,
                    sPassword             : in string, 
                    bForceLegacyInputMode : in boolean optional ): boolean;
Parameter Description
uTestObject The XPath locator or the handle to the DOM element.
sPassword The password to be set.
bForceLegacyInputMode Optional: Replays the BrowserSetPassword function in legacy input mode even if Legacy input mode is disabled or BrowserSetOption(BROWSER_OPT_LEGACY_INPUT_MODE, true) is scripted (JavaScript events instead of Windows API-level events). Default is FALSE.

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);
    
    // navigate to the login site
    BrowserNavigate("http://demo.borland.com/TestSite/LoginForm.html");
    // set the authentication for the secure site
    BrowserSetText("//INPUT[@name='user']", "BasicAuthUser");
    BrowserSetPassword("//INPUT[@name='pwd']", Decrypt3DES("Ax7/X9sk1kIfHlbAZ434Pq4="));
    // submit the form
    BrowserClick("//INPUT[@value='Submit Query']", BUTTON_Left);
  end TMain;