BrowserDlgSetButton Function

Action

Stores a button press command in the dialog command storage. If a dialog pops up during replay, this button press command is used for the specified dialog. 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

BrowserDlgSetButton( sDialog : in string, 
                     sButton : in string ): boolean;
Parameter Description
sDialog The caption of the dialog with a sequence number.
sButton The name of the button.

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;