|
Find UI object
Searches a UI object such as a push button, menu item, text box, link or page tab in a window. And then you could carry out an action
on the UI object , such as moving the mouse pointer to the object, clicking or double-clicking on the object.
- For more information about locating a window, please refer to "Locate a Window".
- For more information about caring out a mouse action on the UI object , please refer to "Mouse Action on Object".
Parameters
-
Object type Specifies the type of object.
-
Object class name must be Specifies whether to check out the object's class name.
-
Object name Specifies whether to check out the object's name.
-
Object value Specifies whether to check out the object's value.
-
Object position must be Specifies whether to check out the object's position. The coordinates
specified are relative to the window (not the screen).
-
Index of objects that match criteria Specifies the ordinal number when there are more than one object match the search criteria.
UI object Path
Like windows on the desktop, windows objects are hierarchically interrelated with each other as well. The terms parent, child, sibling and path are used to describe the relationships.
- In the UI object tree, the top UI object is called the root (desktop window)
- Every UI object has exactly one parent, except the root (which has no parent)
- A UI object can have a number of children
- Siblings (brothers or sisters) are UI Objects with the same parent
- A UI object path consists of the UI object of all the tree UI Objects that must be navigated to reach specific UI object , starting at a top UI object .聽
First Example
<window>.<client>.<window>(3).<editable text[text='Hello']>
Example Explained
- There are four nodes in this path, and they are separated by the period character (.) from each other
- A node is surrounded by angle brackets, and the third node is followed by an ordinal number which enclosed in parentheses
- The text between angle brackets are the object type and filter expression, the filter expression is surrounded by square brackets
Syntax of Window Path
<Object type [Filter expression]>(Ordinal number).<Object type [Filter expression]>(Ordinal number)...
A node in path is consist of the object type, filter expression and ordinal number. The node begins with a left angle bracket (<), followed immediately by the class name. An optional filter expression surrounded by square brackets can follow the class name. A right angle bracket (>) closes the node. An optionally ordinal number surrounded by parentheses can follow immediately the node close character (>). Multiple nodes in path are separated by the period character (.). The wildcard characters * and ? are allowed to instead of one or more nodes.
Term | Description |
Object type |
Specifies the object type of UI object which is used to distinguish one class of UI object from another. The wildcard character * and ? are allowed. |
Filter expression |
Optionally, specifies an expression for the UI object . Filter expression is used to block from UI Objects that does match the condition. The filter expression must be surrounded by square brackets.
Note The variable cannot be used in the filter expression. |
Ordinal number |
Optionally, specifies the ordinal number that denotes a matched UI object . The ordinal number starts zero. |
Examples
A simplest UI object path that includes the object type only.
<window>
The second UI object with the title "Untitled" started.
<window[name ^= 'Untitled']>(2)
The filter expression has two conditions.
<window[name ^= 'Untitled' and enabled=TRUE]>
The wildcard character * is used in the path.
<window>.*.<editable text[text='Hello']>
Locates the second editbox (object type is editable text) with the value "Hello" started.
<window>.<client>.<window>(3).<editable text[value ^= 'Hello']>(2)
Attributes in Filter Expression
The following table lists the attributes can be used in the filter expression of a UI object path.
Attribute |
Description |
DataType |
name |
Name of the UI object . |
String |
value |
Value of the UI object . |
String |
desc |
Description of the UI object . |
String |
visible |
Tests if the UI object is visible. |
Boolean |
enabled |
Tests if the UI object is enabled. |
Boolean |
checked |
Tests if the UI object is checked. |
Boolean |
haschild |
Tests if the UI object has window any child window. |
Boolean |
inarea |
Tests if the UI object is resided in an area of the parent UI object .
Syntax: inarea="left_of_area, top_of_area, widht_of_area, height_of_area"
For example: inarea="10,10,400,300". |
String |
screenarea |
Tests if the UI object is resided in an area of the screen.
Syntax: screenarea="left_of_area, top_of_area, widht_of_area, height_of_area".
For example: screenarea="10,10,400,300". |
String |
left |
The position of the UI object relative to the left edge of the parent UI object . |
Number |
top |
The position of the UI object relative to the top edge of the parent UI object . |
Number |
right |
The position of the UI object relative to the right edge of the parent UI object . |
Number |
bottom |
The position of the UI object relative to the bottom edge of the parent UI object . |
Number |
sleft |
The position of the UI object relative to the left edge of the screen. |
Number |
stop |
The position of the UI object relative to the top edge of the screen. |
Number |
sright |
The position of the UI object relative to the right edge of the screen. |
Number |
sbottom |
The position of the UI object relative to the bottom edge of the screen. |
Number |
width |
Width of UI object . |
Number |
height |
Height of UI object . |
Number |
Notes
- The variable can not be used in the filter expression. For more information about the expression, click here.
- Some applications use picture or other self-draw controls that may act like standard windows controls but don't support the interfaces
required to communicate with them. The find UI object will not work with these controls (UI object s).
|