BrowserDlgSetText Function

Action

Stores a text command in the dialog command storage. If a dialog pops up during replay, the text is the user input for the specified text input field. Usually only the recorded API calls shall be used for replaying, because the captions and sequence numbers are detected during recording.

Include file

BrowserAPI.bdh

Syntax

BrowserDlgSetText( sDialog   : in string, 
                   uPosition : in number, 
                   sText     : in string ): boolean;
Parameter Description
sDialog The caption of the dialog with a sequence number.
uPosition The text field position inside the dialog.
sText The string which shall be used as user input.

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);
    BrowserNavigate("http://demo.borland.com/TestSite/common_main.asp#Popup");
    
    // store the text "John Smith" to be inserted into a pop-up dialog's textbox
    BrowserDlgSetText("Explorer User Prompt #1", 0, "John Smith");
    // store the button press for the first popup
    BrowserDlgSetButton("Explorer User Prompt #1", "OK");
    // store the button press for the second popup
    BrowserDlgSetButton("Message from webpage #2", "OK");    
    // click on prompt-button to start popping up dialogs
    BrowserClick("//INPUT[@value='Prompt']", BUTTON_Left);    
    // clear the dialog command storage
    BrowserDlgStop();
  end TMain;