Generic Message Box Declaration

This functionality is available only for projects or scripts that use the Classic Agent.

When Silk Test Classic generates the window declarations for the main window of your application, it also includes a declaration for a generic object named MessageBox. Therefore, you do not have to record a declaration for each of the message boxes (potentially hundreds) in your application.

A message box is a dialog box that has static text and pushbuttons, but no other controls. Typically, message boxes are used to prompt users to verify an action, for example Save changes before closing?, or to alert users to an error.

The message box declaration is generic for three reasons:

If your application contains message boxes that have extra pushbuttons or if your pushbuttons use different names, you need to add the declarations for those buttons to the declaration for the generic MessageBox object. For example, if a message box contains a Test pushbutton, you need to add the following lines to the recorded declaration:

PushButton Test
   tag "Test"

Here is the declaration for the generic message box:

window MessageBoxClass MessageBox
   tag "~ActiveApp/[DialogBox]$MessageBox"
   PushButton OK
      tag "OK"
   PushButton Cancel
      tag "Cancel"
   PushButton Yes
      tag "Yes"
   PushButton No
      tag "No"
   StaticText Message
      mswnt tag "#2"
      tag "#1"