When the Error Occurs
TestComplete displays this message if you selected the Work With Object Through Property menu command for the On-Screen Action keyword-test operation and then chose a property in the Select Property dialog that cannot be used with this operation.
What Does It Mean?
The On-Screen Action operation simulates user actions over a process, window or control existing in the operating system. Using the “Work With Object Through Property” command you can change the object, with which the operation works, to some other object that is not available in the object hierarchy and that is accessed through a property of the current object. A typical example is that you use this command for a top-level window to work with the main menu displayed by this window. The entire procedure includes three steps:
-
You choose the “Work With Object Through Property” command for an operation.
-
In the subsequent dialog, you choose the property that returns a reference to the desired new object.
TestComplete replaces the operation’s current object with the object selected in the dialog.
-
In the Operation column of the Keyword Test editor you specify the object’s method or property to be called.
See Calling Methods and Properties of "Internal" Objects.
In order for the “Work With Object Through Property” command to be able to work successfully, the property you selected must return a valid reference to some object and that object must contain methods and properties. If these conditions are not met, TestComplete displays this message to inform you about the problem.
About the Property Name in the Message
In the message, TestComplete specifies the property name along with the full name of its object.
Keyword tests typically works with mapped object names, that is why the full object name starts with the Alias or NameMapping prefix. The Keyword Test editor does not display objects' full names to make name notation shorter. However, you can see the full names in properties of some operations.
Why TestComplete Fails to Find Methods and Properties
-
Typically, this happens if the property you chose in the Select Property dialog returns a null object reference. For instance, if a property returns a reference to some application form and that form does not exist, the property will return null (
Nothing
in VBScript,null
in JavaScript, JScript, C++Script and C#Script,None
in Python, andnil
in DelphiScript).To solve the problem, make sure the needed conditions are met (for instance, that the needed objects exist) and then try using the “Work With Object Through Property” command again.
To check whether the property returns null or not, launch your tested application and explore its objects and their methods and properties in the Object Browser panel. To find the current object in the Object Browser faster, right-click your operation in the Keyword Test editor and choose Show in Object Browser from the context menu. Then find the desired property in the property list on the right and check if it returns a null object.
In certain cases, a property can always return null. For instance, if TestComplete recognizes a window as a top-level window, it will append the
MainMenu
property to it. This property provides access to the main menu items. If the window has no menu, then theMainMenu
property will always return null.Another typical example of a property that always returns null is the
PopupMenu
property. It returns an object that provides access to context menu items. This object exists and TestComplete can obtain information about its methods and properties only if the context menu is visible. At design time, this menu is hidden (even if you invoke this menu in your application, it will disappear after you switch to the TestComplete window), so you will not be able to work with the menu's items through thePopupMenu
property. To work with this menu, add the Menu Action operation to your keyword test. -
Another possible reason is that TestComplete has no information on methods and properties of the object, which the selected property returns. This can happen if your tested application is an Open Application and you chose a property that returns a reference to some native object and TestComplete was unable to obtain methods and properties of this object.
This can happen for the following reasons:
-
The object’s methods and properties are not available to TestComplete. See Object Properties, Fields and Methods That Are Unavailable to TestComplete.
-
The object contains only protected and private properties that are hidden by default. To make these properties available, activate the Show hidden members setting in the Engines - General Options dialog. See also Access to Properties.
-
See Also
Calling Methods and Properties of "Internal" Objects
On-Screen Action Operation
Menu Action Operation
About Keyword Test Editor
Object Properties, Fields and Methods That Are Unavailable to TestComplete
Access to Properties