Using global pos to identify UI elements

There may be times when you have to interface with a control that is not easy to identify with any of the conventional TA properties available to you. Perhaps you cannot be assured that any property-value pair, or set of pairs, is both unique and consistent. In such cases, you may be able to make use of the control’s global pos property. global pos is a TA property that is generated by TestArchitect for each available control of a given window, and is essentially independent of any of that control’s native properties. Each such control is assigned a global pos value that is unique within that window.

注意: 
Where possible, it is suggested that you use the anchor pos property in preference to global pos.

Values for the global pos property of each control are generated by TestArchitect during a window intake. The global pos value assigned to a control consists of two parts: the control’s TA class, followed by a numeric index. The index is determined by the control’s physical position within the window with respect to other controls of the same class. The two parts are separated by a space:

<ta class> <index>

How TestArchitect assigns global pos values

TestArchitect limits global pos assignment to controls that are both visible and not children of locked containers. Among the controls that are eligible for assignment, the determination of the index value of a control’s global pos is based upon that control’s physical position relative to the other controls of its class. Scanning for global pos assignment proceeds from top to bottom. When two or more same-class controls are found which are vertically aligned, numeric assignment is from left to right.

The AUT window below consists of labels and their associated images. It illustrates the fact the global pos indexes start at 1 for each control class, and index assignments are based on each control’s position relative to other controls of its own class. Hence, for example, the picture of the Toyota Prius, being the uppermost picture image control, receives a global pos of image 1, while its label, which is not physically the highest label, is assigned a global pos of label 2.

Note that only physical position is considered, not logical position. So, for instance, the fact that some controls of the image class may exist together in a (unlocked) treeview, while others live outside of the treeview, does not factor into the global pos assignment method.

Risks and benefits

The benefit of using global pos is that each control is guaranteed to have a unique global pos value within its window at any given point in time. The risk, on the other hand, is that for dynamically changing windows, global pos values of controls may differ over time. For example, global pos values are only assigned to visible controls; hence, the expansion of a tree node during testing, exposing additional tree nodes, affects the global pos values of tree nodes below it. Dynamic web pages are also often a case where relying on global pos can pose risks. This is why, as an alternative to global pos, it is recommended that the anchor pos property be considered for such dynamic environments.


Copyright © 2024 LogiGear Corporation. All rights reserved. LogiGearはLogiGear Corporationの登録商標であり、Action Based TestingおよびTestArchitectはLogiGear Corporationの商標です。ここに記載されているその他の商標は、各所有者の財産です。

LogiGear Corporation

1730 S. Amphlett Blvd. Suite 200, San Mateo, CA 94402

Tel: +1 (650) 572-1400