Version

xamContextMenu - Recordable Methods

Topic Overview

Purpose

This topic provides reference information about the recordable user methods for testing the xamContextMenu™ control.

xamContextMenu Test Object Recordable Methods Summary

Recordable methods summary chart

The following table briefly explains the recordable methods for testing the control. Detailed information about the methods is provided in the text blocks following the table.

Method Description

Checks a xamContextMenu item checkbox.

Clicks on a specified menu item.

Unchecks a xamContextMenu item checkbox.

CheckMenuItem Method

Description

The CheckMenuItem records and replays the marking of the check box of a specified menu item.

Details

When the marking of the checkbox of a menu item action is recorded, the location of the menu item is stored as a unique path. This path consists of the headers of the parent menus’ items and the header of the targeted menu item.

In case there are duplicate or missing headers, the menu item index is recorded.

When a testing script is being created manually, you the following options are available for specifying the path to the menu item:

  • headers

  • indexes

  • a combination of headers and indexes

When replaying the marking action, if the checkbox is already marked, the action is ignored and the checkbox remains marked.

Parameters

The following table explains the method’s parameters along with some sample code.

Method parameter Description

Header identifier

The unique menu item header identifier is:

  • for root menu items: the header

  • for sub-menu items: the path to the item consisting of the headers of the parent items pointing to the item, stored in an array

Note: The menu items are listed in hierarchically downward order, i.e. root item, sub-item, sub-sub-item (see the example).

Example

Marking the checkbox of an item named “ Pdf ” which has a parent item File belonging to the root menu item Create (Create>File>Pdf):

WpfWindow("MainWindow").XamContextMenu("xamContextMenu1").CheckMenuItem ARRAY("Create", "File", "Pdf")

Index identifier

The unique menu item index identifier is:

  • for root menu items: the index

  • for sub-menu items: the path to the item consisting of the indexes of the parent items pointing to the item, stored in an array

Note: The menu items are listed in hierarchically downward order, i.e. root item, sub-item, sub-sub-item (see the example).

Example

Checking the checkbox of the third child menu item starting from the first root menu item and its first child:

WpfWindow("MainWindow").XamContextMenu("xamContextMenu1").CheckMenuItem ARRAY(0, 0, 2)

Default setting

No default settings.

Possible exceptions

The following table lists the possible exceptions for the method and the reason that is likely to be causing them.

Exception name Exception description Possible reasons

Cannot perform the specified action as the item is not checkable.

The specified menu item cannot be checked.

The menu item property IsCheckable is not set to True.

The following item was not found.

The xamContextMenu item with the specified header text cannot be found.

The method parameter is not correct.

The specified index is out of range.

The xamContextMenu item with the specified index cannot be found.

The method parameter is not within the valid range of item indexes.

SelectMenuItem Method

Description

The SelectMenuItem method records and replays a mouse click on a specifed xamContextMenu item.

Details

When a click on a menu item is recorded, the location of the menu item is stored as a unique path. This path consists of the header of the parent menu items and the header of the targeted menu item.

In case there are duplicate or missing headers, the index of the item is recorded.

When a testing script is created manually, you can use the following options to specify the path to the menu item:

  • headers

  • indexes

  • combination of headers and indexes

Parameters

The following table explains the method’s parameters along with some sample code.

Method parameter Description

Header identifier

The unique menu item header identifier is:

  • for root menu items: the header

  • for sub-menu items : the path to the item consisting of the headers of the parent items pointing to the item, stored in an array

Note: The menu items are listed in hierarchically downward order, i.e. root item, sub-item, sub-sub-item (see the example).

Example

Clicking on a child xamContextMenu item File with a parent named Create :

WpfWindow("MainWindow").XamContextMenu("xamContextMenu1").SelectMenuItem ARRAY("Create", "File")

Index identifier

The unique menu item index identifier is:

  • for root menu items: the index

  • for sub-menu items: the path to the item consisting of the indexes of the parent items pointing to the item, stored in an array

Note: The menu items are listed in hierarchically downward order, i.e. root item, sub-item, sub-sub-item (see the example).

Example

Clicking on the third child of the first root menu item:

WpfWindow("MainWindow").XamContextMenu("xamContextMenu1").SelectMenuItem ARRAY(0, 2)

Default setting

No default settings.

Possible exceptions

The following table lists the possible exceptions for the method and the reason that is likely to be causing them.

Exception name Exception description Possible reasons

The following item was not found.

The xamContextMenu item with the specified header text cannot be found.

The method parameter is not correct.

The specified index is out of range.

The xamContextMenu item with the specified index cannot be found.

The method parameter is not within the valid range of item indexes.

UnCheckMenuItem Method

Description

The UnCheckMenuItem method is used for recording and replaying unchecking the check box of a specified menu item.

Details

When the unchecking of a menu item checkbox action is recorded, the location of the menu item is stored as a unique path. This path consists of the header of the parent menu items and the header of the targeted menu item.

In case there are duplicate or missing headers, a menu item index is recorded.

When a testing script is created manually, you can use the following options to specify the path to the menu item:

  • headers

  • indexes

  • combination of headers and indexes

When replaying the unchecking, if the item is already unchecked, the action is ignored and the item remains unchecked.

Parameters

The following table explains the method’s parameters along with some sample code.

Method Parameter Description

Header identifier

The unique identifier of the menu item header is:

  • for root menu items: the header

  • for sub-menu items : the path to the item consisting of the headers of the parent items pointing to the item, stored in an array

Note: The menu items are listed in hierarchically downward order, i.e. root item, sub-item, sub-sub-item (see the example).

Example

Unchecking the checkbox of a child menu item Pdf with root menu item – Create and a parent – File ( Create>File> Pdf ):

WpfWindow("MainWindow").XamContextMenu("xamContextMenu1").UnCheckMenuItem ARRAY("Create", "File", "Pdf")

Index identifier

The unique menu item index identifier is:

  • for root menu items: the index

  • for sub-menu items: the path to the item consisting of the indexes of the parent items pointing to the item, stored in an array

Note: The menu items are listed in hierarchically downward order, i.e. root item, sub-item, sub-sub-item (see the example).

Example

Unchecking the checkbox of the third child menu item starting from the first root menu item and its first child:

WpfWindow("MainWindow").XamContextMenu("xamContextMenu1").UnCheckMenuItem ARRAY(0, 0, 2)

Default setting

No default settings.

Possible exceptions

The following table lists the possible exceptions for the method and the reason that is likely to be causing them.

Exception name Exception description Possible reasons

Cannot perform the specified action as the item is not checkable.

The specified menu item cannot be unchecked.

The menu item property IsCheckable is not set to True.

The following item was not found.

The xamContextMenu item with the specified header text cannot be found.

The method parameter is not correct.

The specified index is out of range.

The xamContextMenu item with the specified index cannot be found.

The method parameter is not within the valid range of item indexes.

Related Topics

The following table lists other topics you may find useful.

Topic Purpose

This topic provides information about the user actions of the xamContextMenu™ control which you can test and the elements you can inspect.

This topic provides reference information about the replay-only user methods for testing the xamContextMenu™ control.

This topic provides reference information about the inspectable test object properties of the xamContextMenu™ control.

This topic provides reference information about the proxy class that supports the testing of the xamContextMenu™ control in Micro Focus Unified Functional Testing software.