|TestObj||A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section|
The property is applied to the following object:
To view this property in the Object Browser panel and in other panels and dialogs, activate the Advanced view mode.
The property has the following parameter:
Specifies the item you want to get. An item can be specified by its name or index in the menu:
Log.Message ( w.MainMenu.Items("File").Caption )
Log.Message ( w.MainMenu.Items(0).Caption )
The index is zero-based, that is, the first item has an index of 0, the second - 1, and so on. The index of the last item is
Count - 1.
If you specify an item by its name, TestComplete will treat this name as case-sensitive or case-insensitive according to the Use case-sensitive parameters project property. You can use wildcards (* and ?) in item names, where the asterisk corresponds to a string of any length and the question mark - to any single character.
An item name should not include a special character that is used to create an access key for that item. To specify an access key, developers typically insert an ampersand before the desired character in the item name. So, an ampersand is one of these special characters. Another special character is an underscore. It is used to specify access keys for WPF menu items. So, if you are working with WPF menus, you should specify item names that do not include these “special” characters. Typically, only the first found ampersand or underscore is treated as a special character. The other ampersands and underscores are treated as ordinary characters.
MenuItem object that provides scripting interface to the desired menu item.
If you use Python or DelphiScript, you should enclose the parameter of the
Items property in square brackets:
Separators are also treated as menu items.
The following example demonstrates how to obtain a menu item by its caption.
def MenuSample(): # Obtains the Notepad main menu MainMenu = Sys.Process("Notepad").Window("Notepad", "*").MainMenu # Obtains a menu item by its caption Item = MainMenu.Items["File"]