BrowserSetText Function

Action

This function can be used to set the text of a text field or text area element. The BrowserSetText function applies to the HTML elements <input type='text'> and <textarea>.

Include file

BrowserAPI.bdh

Syntax

BrowserSetText( uTestObject           : in union,
                sText                 : in string
                bForceLegacyInputMode : in boolean optional ): boolean;
Parameter Description
uTestObject The XPath locator or the handle to the DOM element.
sText The text to be set.
bForceLegacyInputMode Optional: Replays the BrowserSetText 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;