Properties Object (Collection)
Description
A 0-based collection of Property items created by a Create Method statement. (Each Property item contains a property name and value pair and an indication of whether the value is evaluated as a regular expression.)
After you have added a set of Property items to your Properties collection object, you can specify the Properties object in place of a test object name or programmatic description in a step.
You can also create several Properties objects in your test if you want to use programmatic descriptions for several objects.
For more details on programmatic descriptions, see the OpenText Functional Testing User Guide.
Syntax
You can retrieve Property objects from a Description object using the syntax:
Set PropObj=MyDesc ("PropName")
IMPORTANT
When working with Properties objects, you can use variables for the property item names or values to generate the object description based on properties or values you retrieve during a run session.
The following example uses the Create method to return a Properties collection object named EditDesc
, and then uses the returned object to instruct OpenText Functional Testing to enter the text: MyName
in the first WebEdit object in the Advantage Online Shopping page with the name username
.
set EditDesc = Description.Create()
EditDesc("Name").Value = "username"
EditDesc("Type").Value = "text"
Browser("Advantage Shopping").Page("Advantage Shopping").WebEdit(EditDesc).Set "MyName"
Methods and Properties
Add | Adds the specified property item from another Properties object to your Properties object. |
Count | Returns the number of property items in the Properties collection. |
Item | Accesses a specific property item in a Properties collection, to set or retrieve its value. |
Name | Sets or retrieves the name of an existing property item in the Properties collection, or adds a new property item if the specified property item does not exist in the collection. |
RegularExpression | Indicates whether the value of a property item in the Properties collection is a regular expression. |
Remove | Removes the specified property item from the Properties collection. |
Value | Sets or retrieves the value of an existing property item in the Properties collection, or adds a new property item if the specified property name does not exist in the Properties collection. |
Add Method
Description
Adds the specified property item from another Properties object to your Properties object.
Syntax
PropertiesColl.Add PropColl(Position)
Argument | Type | Description |
---|---|---|
PropColl(Position) | Variant | The item of the property collection you want to add. Specify the item in the format:
Index position numbers begin with 0. |
The following example adds the first item from the OtherCollection
Properties object to the MyDesc
Properties object.
MyDesc.Add OtherCollection(0)
Count Method
Description
Returns the number of property items in the Properties collection.
Syntax
PropertiesColl.Count
The following example finds the number of property items in the MyDesc collection.
PropCount = MyDesc.Count
Item Method
Description
Accesses a specific property item in a Properties collection, to set or retrieve its value.
Syntax
PropertiesColl.Item(Item)
Argument | Type | Description |
---|---|---|
Item | Variant | The property item you want to access. Specify the name of the property or its index position. Position numbers begin with 0. |
IMPORTANT
You can also access an item within a collection by specifying its name or index, without using the Item method. However, when you use the Item method to access an item in a collection, OpenText Functional Testing's statement completion feature displays the collection object's properties.
The following example adds the Type
property to the EditDesc
object and sets its value to text
to instruct OpenText Functional Testing to click on the first WebEdit object in the Advantage Online Shopping page with the name username
.
set EditDesc = Description.Create()
EditDesc("Name").Value = "username"
EditDesc("Type").Value = "text"
Browser("Advantage Shopping").Page("Advantage Shopping").WebEdit(EditDesc).Click
The following example sets the Name
property in a new MyDescription
object to the value of the 1st property in the EditDesc
object, and then prints that value.
set MyDescription = Description.Create()
MyDescription("Name").Value = EditDesc.Item(0).Value
Msgbox(MyDescription.Item(0).Value)
Name Property
Description
Sets or retrieves the name of an existing property item in the Properties collection, or adds a new property item if the specified property item does not exist in the collection.
Syntax
To set a property name: PropertiesColl(PropIndex).Name = PropName
To retrieve a property name: PropName = PropertiesColl(PropIndex).Name
Argument | Type | Description |
---|---|---|
PropIndex | Number | The index position of the property item whose name you want to set or retrieve. Index position values begin with 0. |
PropName | String | The new name for the specified property, or the retrieved name. |
The following example creates a Properties collection object named desc, and then displays a message containing the Name and Value properties of all the items in the collection.
Set desc = Description.Create
desc("prop.1").Value = "val.1"
desc("prop.2").Value = "val.2"
desc("prop.3").Value = "val.3"
Dim logLine
logLine = "The content of the Description object:" & vbNewLine
For i = 0 To desc.Count - 1
logLine = logLine & vbTab & "Name: " & desc(i).Name & vbTab & "Value: " & desc(i).Value & vbNewLine
Next
MsgBox logLine
RegularExpression Property
Indicates whether the value of a property item in the Properties collection is a regular expression.
Note: By default, the values of all property items added to a Properties collection are treated as regular expressions. Use the RegularExpression property to change this setting for a specific property item in the collection.0
Syntax
PropertiesColl(Property).RegularExpression = BooleanSetting
Argument | Type | Description |
---|---|---|
Property | Variant | The property item for which you want to specify the regular expression value. Specify the name of the property or its index position in the collection. Index position numbers begin with 0. |
BooleanSetting | Boolean | The new value for the specified property. |
The following example uses the RegularExpression property to set the value of the PropName property item as a literal value.
set MyDesc = Description.Create()
MyDesc("PropName").Value = PropValue
MyDesc("PropName").RegularExpression = False
Remove Method
Description
Removes the specified property item from the Properties collection.
Syntax
PropertiesColl.Remove Item
Argument | Type | Description |
---|---|---|
Item | String | The property item you want to remove. Specify the name of the property or its index position. Position numbers begin with 0. |
The following example removes the Name property item from the MyDescr1
Properties object.
MyDescr1.Remove "Name"
The following example removes the Nth item from the MyDescr1Properties object, where N is a variable representing the index position of the item.
MyDescr1.Remove N
Value Property
Description
Sets or retrieves the value of an existing property item in the Properties collection, or adds a new property item if the specified property name does not exist in the Properties collection.
Syntax
To set a property value: PropertiesColl(Property).Value = PropVal
To retrieve a property value: PropVal = PropertiesColl(Property).Value
Argument | Type | Description |
---|---|---|
Property | Variant | The property item for which you want to set a value, or from which you want to retrieve a value. Specify the name of the property or its index position in the collection. Index position values begin with 0. |
PropValue | Variant | The new value for the specified property, or the value retrieved. |
The following example adds the Type
property to the EditDesc
object and sets its value to text
to instruct OpenText Functional Testing to click on the first WebEdit object in the Advantage Online Shopping page with the name username
.
set EditDesc = Description.Create()
EditDesc("Name").Value = "username"
EditDesc("Type").Value = "text"
Browser("Advantage Shopping").Page("Advantage Shopping").WebEdit(EditDesc).Click
The following example replaces the 1st
property in the MyDescription
object with the 1st property from the OtherDescription
object.
MyDescription(1).Value = OtherDescription(1).Value
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