Hello Vahagn,
I need this because I have an object that not exist and it is exact that is not exist but in Log I receive error. |
TestComplete has a set of special methods that you can use to check whether an object exists. Please refer to the
Checking Whether an Object Exists help topic to learn more.
I write Call wMainForm.PopupMenu.Check("operationname", False). If "operationname" is not exist I receive Log error. |
It is not a good approach to prohibit posting an error in such a case. I recommend that you create a helper function that will check whether a specific menu item exits. Here is a simple example that works with Notepad:
Function MenuItemExists(menu, caption)
MenuItemExists = False
For i = 0 to (menu.Count - 1)
If aqString.Compare(menu.Items(i).Caption, caption, False) = 0 Then
MenuItemExists = True
End If
Next
End Function
Sub Test
Dim edit
Set edit = Sys.Process("notepad").Window("Notepad", "*").Window("Edit")
Call edit.ClickR(115, 116)
If MenuItemExists(edit.PopupMenu, "Paste") Then
Log.Message("The menu item exists")
Else
Log.Message("The menu item DOES NOT exist")
End If
End Sub