We're sorry but this site requires JavaScript.
Is this content useful?
Thank you for your feedback!
Thank you for your feedback! You have rated this topic in the last 30 days.
xamContextMenu - Replay-Only Methods
Topic Overview
Purpose
This topic provides reference information about the replay-only user methods for testing the xamContextMenu™ control.
In this topic
This topic contains the following sections:
xamContextMenu Test Object Replay-Only Methods Summary
Replay-only methods summary chart
The following table briefly explains the replay-only methods for testing the control. Detailed information about the methods is provided below the table.
Method
Description
Closes the sub-menu of the specified menu item.
Opens the sub-menu of the specified menu item.
Returns the number of the sub-menu items of the specified menu item.
Returns a new-line-delimited list with the headers of the sub-menu items of specified menu item.
CloseUp Method
Description
The CloseUp method replays the collapsing of the submenu of the specified menu item.
Details
The method takes the menu item identifier as parameter. The identifier is a path to the menu item which submenu is to be collapsed.
This path may consist of:
Parameters
The following table explains the method’s parameters along with some sample code.
Method parameter
Description
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).
Collapsing the submenu of the Recent menu item which is a child item of the File menu item:
WpfWindow("MainWindow").XamContextMenu("xamContextMenu1").CloseUp Array("File", "Recent")
Collapsing the submenu of the root item File :
WpfWindow("MainWindow").XamContextMenu("xamContextMenu1").CloseUp "File"
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).
Collapsing the submenu of the sub menu item with index 0:
WpfWindow("MainWindow").XamContextMenu("xamContextMenu1").CloseUp Array(0, 0)
Collapsing the submenu of the root item with index 0:
WpfWindow("MainWindow").XamContextMenu("xamContextMenu1").CloseUp 0
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 [" since the menu item has no submenu"].
The method cannot be replayed because the specified menu item has no submenu to be collapsed.
The specified menu item has no sub item.
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.
DropDown Method
Description
The DropDown method replays the opening of the submenu of the specified menu item.
Details
The method takes the menu item identifier as parameter. The identifier is a path to the menu item whose submenu is to be expanded.
This path may consist of:
Parameters
The following table explains the method’s parameters along with some sample code.
Method parameter
Description
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).
Opening of the submenu of the root item File :
WpfWindow("MainWindow").XamContextMenu("xamContextMenu1").DropDown "File"
Opening of the submenu of the Recent menu item which is a child item of File sub menu item.
WpfWindow("Test Automation Samples").XamContextMenu("xamContextMenu1").DropDown Array("File", "Recent")
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).
Opening of the submenu of the root item with index 0 :
WpfWindow("MainWindow").XamContextMenu("xamContextMenu1").DropDown 0
Opening of the submenu of the sub-menu item with index 0 :
WpfWindow("MainWindow").XamContextMenu("xamContextMenu1").DropDown Array(0, 0)
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 [" since the menu item has no submenu"].
The method cannot be replayed because the specified menu item has no sub item to be expanded.
The specified menu item has no sub item.
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.
Description
The GetChildrenCountOfMenuItem method returns the number of the children of the specified menu item.
Details
The method takes the menu item identifier as a parameter. The identifier is a path to the menu item the children count you want to retrieve.
This path may consist of:
Parameters
The following table explains the method’s parameters together with some sample code.
Method parameter
Description
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).
Displaying a message box showing the number of the children of the File menu item:
msgbox(WpfWindow("MainWindow").XamContextMenu("xamContextMenu1").GetChildrenOfMenuItem ("File"))
Displaying a message box showing the number of the children of the Recent menu item. Recent menu item is a child item of the root item File :
msgbox(WpfWindow("MainWindow").XamContextMenu("xamContextMenu1").GetChildrenOfMenuItem (Array("File", “Recent”)))
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).
Displaying a message box showing the number of the children of the root item with index 0 :
msgbox(WpfWindow("MainWindow").XamContextMenu("xamContextMenu1").GetChildrenOfMenuItem (0))
Displaying a message box showing the number of the children of the submenu item with index 0 which is under root item with index 0 :
msgbox(WpfWindow("MainWindow").XamContextMenu("xamContextMenu1").GetChildrenOfMenuItem (Array(0, 0)))
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 menu item with the specified header text cannot be found.
The method parameter is not correct.
The specified index is out of range.
The menu item with the specified index cannot be found.
The method parameter is not within the valid range of item indexes.
Description
The GetChildrenOfMenuItem method returns a new-line-delimited list with the headers of the children of the specified menu item.
Details
The method takes the menu item identifier as parameter. The identifier is a path to the menu item the children list you want to retrieve.
This path may consist of:
Parameters
The following table explains the method’s parameters along with some sample code.
Method parameter
Description
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).
Displaying a message box showing the list with headers (if any) of the children of the File menu item:
msgbox(WpfWindow("MainWindow").XamContextMenu("xamContextMenu1").GetChildrenOfMenuItem ("File"))
Displaying a message box showing the list with headers (if any) of the children of the Recent menu item. Recent menu item is a child item of the root item File :
msgbox(WpfWindow("MainWindow").XamContextMenu("xamContextMenu1").GetChildrenOfMenuItem (Array("File", “Recent”)))
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).
Displaying a message box showing the list with headers (if any) of the children of the root item with index 0:
msgbox(WpfWindow("MainWindow").XamContextMenu("xamContextMenu1").GetChildrenOfMenuItem (0))
Displaying a message box showing the list with headers (if any) of the children of the submenu item with index 0 which is under root item with index 0:
msgbox(WpfWindow("MainWindow").XamContextMenu("xamContextMenu1").GetChildrenOfMenuItem (Array(0, 0)))
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 menu item with the specified header text cannot be found.
The method parameter is not correct.
The specified index is out of range.
The menu 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 recordable 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.