Model Object Attributes
Each node in the tree structure in the model manager is a model object, an automation object that matches and manipulates controls that match the target control in the application being automated via its own Identify Properties and manipulates the target control via its own API - --- object manipulation API to manipulate the target control.
Therefore, understanding the object recognition properties helps us figure out which recognition properties to use in different situations to achieve the best match.
Note that you will see the word
Properties
in theOperations
tab of the model manager. But actually these properties refer to the object manipulation APIs that return information about the control, and are just a classification of API operations. For details, you can check the APIs for a specific technology, for example in the section Winodws Automation. ! Identify Properties
Overview of Identify Properties
When manipulating controls, it is preferred to locate the target control in the application based on the object's own identification properties, and then perform the appropriate action on the control. Thus, unreasonable identification properties may result in.
- cannot match the target control: error "1001: cannot find this object".
- multiple target controls are matched: the upper right corner of the model manager indicates that multiple controls were found, and the lower left corner lists the location information of all controls.
For the former case, it will lead to error reporting in operation and is a must; while for the latter case, try to avoid it by setting reasonable identification properties.
Notes for Identify Properties
The spyware automatically recommends some identification attributes when it identifies added controls. Some properties of the control are used as basic identification properties, such as:
type
,name
,automationId
, etc. Except for the requiredtype
identification property, which identification properties are generated depends on the type of the target control and which properties it has.Identifying properties are created based on the state of the control when it is added to the Model Manager. Therefore, if some properties of the control are dynamically generated, they should not be used as identifying properties. For example, to get the results of a calculator, you need to identify the
Text
control that displays the results of the calculation, as shown below. This is where using itsname
property becomes very unreliable, as you can see that thename
property changes along with the content, so when adding this display panel control, manually remove thename
property to ensure that it matches the control where the results are located.Identifying properties vs Runtime properties.
- Objects have recognition properties, which as you can understand from the previous reading are for matching controls, are stored in the model file, or defined in the code (describing the schema). In addition, to improve recognition, the model manager additionally provides some auxiliary recognition properties, such as
index
,levelToParent
, etc. - Runtime properties are the property values obtained from the control during automation. And depending on the control type, different APIs are provided to get these properties. For example,
hwnd
returns the handle of the control window,x
ory
returns the location of the control, etc. - They may be partly the same between the two. But the runtime properties may be changed over time by the application itself.
- Objects have recognition properties, which as you can understand from the previous reading are for matching controls, are stored in the model file, or defined in the code (describing the schema). In addition, to improve recognition, the model manager additionally provides some auxiliary recognition properties, such as
Identify Properties and Other Properties?
In the Object Properties
tab, you can see that the attributes are divided into Identify Properties
and Other Properties
, Identify Properties is a set of Identify Properties
that are in effect, Other Properties
are only displayed but not in effect, you can use the Add Property
button to add them to Identify Properties
, or a quicker way is to right click on one of the other attributes and select Set as Identify Propertie
. You can add them to the Identify Properties
using the add property
button, or more quickly by right-clicking on one of the other attributes and selecting set as Identify Propertie
.
Identify properties and classification
When spying on a control, all available identifying properties of the control are retrieved and given appropriate default values based on the properties of the current control. You can also manage the recognition properties of the control in the Model Manager and manually edit the values of the recognition properties to better match the control.
Different types of control objects have different identification attributes. Refer to the help for each automation technique for information on the corresponding identification attributes, for example
- Identifying Properties of Windows
- Qt Object's Identified Attributes
- Identification properties of pattern objects
Chinese version click here.