VisualRelations Object
Description
Represents the visual relation identifier element of a test object. Use this object create a new VisualRelationsCollection object. For more details, see VisualRelationsCollection Object.
Methods
Create | Returns an empty VisualRelationsCollection Object, which you can use to define the related objects for a test object's visual relation identifier. |
Create Method
Description
Returns an empty VisualRelationsCollection Object, which you can use to define the related objects for a test object's visual relation identifier.
Syntax
setVRIColl = VisualRelations.Create
The following example demonstrates the use of a VisualRelations collection with a test object that has an ambiguous programmatic description. The same test object is used to represent different buttons in the calculator application based on the relative position of the buttons to the left and right of that button. Using these settings, the example below clicks on buttons 2, 5, and 8 in the calculator. (The example assumes that all objects from the calculator application have been added to the object repository.)
For i = 2 to 8 step 3
print "Now selecting the object that matches button " & i & " via the related buttons " & (i-1) & " and " & (i+1)
'Define an ambiguous button object on the calculator.
Set obj = Window("text:=Calculator").WinButton("text:=.*")
'Define two visual relations for the current button.
Set rc = VisualRelations.Create
Set relation = rc.Add
relation.relatedobjectpath = "Window(""Calculator"").WinButton(""" & (i-1) & """)"
relation.relativeposition = micRelLeft
relation.setargument micrelinline, True
Set relation = Nothing
set relation = rc.Add
relation.relatedobjectpath = "Window(""Calculator"").WinButton(""" & (i+1) & """)"
relation.relativeposition = micRelRight
relation.setargument micrelinline, True
Set relation = Nothing
'Update the defined test object with the new visual relation identifier.
obj.SetTOProperty "visual relations", rc
obj.Click
'Release the objects
Set rc = Nothing
Set obj = Nothing
Next
See also:
- Crypt Object
- DataTable Object
- Description Object
- DeviceReplay Object
- DotNetFactory Object
- DTParameter Object
- DTSheet Object
- Environment Object
- Extern Object
- Parameter Object
- JSON Object
- JsonUtil Object
- MercuryTimers Object (Collection)
- MercuryTimer Object
- NV Object
- OptionalStep Object
- ParallelUtil Object
- LocalParameter Object
- PasswordUtil Object
- PathFinder Object
- PDFUtil Object
- Properties Object (Collection)
- QCUtil Object
- RandomNumber Object
- Recovery Object
- Remote Connection Object
- Reporter Object
- RepositoriesCollection Object
- Repository Object
- Services Object
- Setting Object
- SystemMonitor Object
- TestArgs Object
- TextUtil Object
- UIAutomation Object
- VisualRelation Object
- VisualRelations Object
- VisualRelationsCollection Object
- WebUtil Object
- XMLUtil Object