Tricentis Tosca 16.0 Released on Feb-2023 ----- UFT has been upgraded from UFT 15.0.1 to UFT One 15.0.2, Beginning at November 2020.

Saturday 20 February 2021

GetAllROProperties, GetROProperty, GetTOProperties and GetTOProperty

 GetAllROProperties Method :

Returns the collection of properties and current values from the object in the application.

Syntax : object.GetAllROProperties

Example : GetAllROProperties method to retrieve the current values of a WebCheckBox's properties from the application.

Set Props = Browser("Advantage Shopping").Page("Advantage Shopping")._
WebCheckBox("operating_system_1").GetAllROProperties

' Props contains the properties of the check box and their current values
NumberOfProperties = Props.Count
For i = 0 To NumberOfProperties - 1
    Print Props(i).Name & ": " & Props(i).Value
Next

Note : GetAllROProperties differs from the GetTOProperties method. GetAllROProperties returns the collection of properties and their current values from the object in the application during the test run. GetTOProperties returns the values from the test object's description.


GetROProperty Method : Returns the current value of the description property from the object in the application.

Syntax : object.GetROProperty (Property, [PropertyData])

Example : GetROProperty method to retrieve the state of a check box.

Val = Browser("Advantage Shopping").Page("Advantage Shopping")._
WebCheckBox("operating_system_1").GetROProperty("Value")
'val contains the ON or OFF state of the check box

Example : GetROProperty method to retrieve the number of items in a WebRadioGroup.

NumOfItems = Browser("Advantage Shopping").Page("Advantage Shopping")._
WebRadioGroup("safepay").GetROProperty("Items Count")
'NumOfItems contains "2"

Example : Retrieve the Value of a Property in an Edit Box

The following example iterates through the WebEdit objects on a page, searching for a 
specific WebEdit object in order
to set a value for it.
Dim editToSearch, valueToSet, numberOfEdits

'This is the value of the 'name' property for the WebEdit we want to find.

editToSearch = "phone_numberAccountDetails"

valueToSet = "17112345789" 'Create a description object to help 
retrieve all WebEdit objects in a specific page.
Set oDesc = Description.Create()
oDesc("micclass").Value = "WebEdit" 'Retrieve all WebEdit objects in this page

Set EditCollection = Browser("Advantage Shopping").Page("Advantage Shopping").ChildObjects(oDesc)
numberOfEdits = EditCollection.Count
'Search for a specific WebEdit and set its value
For i = 0 To NumberOfEdits - 1
    If EditCollection(i).GetROProperty("name") = editToSearch Then
        EditCollection(i).Set valueToSet
    End If
Next

Note : GetROProperty differs from the GetTOProperty method. GetROProperty returns the current property value of the object in the application during the test run. GetTOProperty returns the value from the test object's description.


GetTOProperties Method : Returns the collection of properties and values used to identify the object.

Syntax : object.GetTOProperties

Example: Display All Properties and Values of a Link Object

'The following example uses the GetTOProperties method to return a Property collection containing the test object description
'(properties and values) for the All kind of Link object. It then displays the property name and value of each property in
'the returned collection.

Set LinkObject = Browser("Index").Page("index").Link("All kind of")
Set Props = LinkObject.GetTOProperties
    PropsCount = Props.Count
For i = 0 To PropsCount - 1
    PropName = Props(i).Name
    PropValue = Props(i).Value
    MsgBox PropName & " = " & PropValue
Next

Example: Retrieve Properties Used to Identify a Table Object

'The following example uses the GetTOProperties method to retrieve the list of properties and values 
used to identify the PRODUCT NAME WebTable.
 Set TableDesc = Browser("Advantage Shopping").Page("Advantage Shopping").WebTable("PRODUCT NAME").GetTOProperties

Note: GetTOProperties differs from the GetROProperty method. GetTOProperties returns the values from the test object's description. GetROProperty returns the current property value of the object in the application during the test run.


GetTOProperty Method : Returns the value of the specified description property from the test object description.

Syntax : object.GetTOProperty (Property)

Example : Retrieve Value of an HTML Tag Property
'The following example uses the GetTOProperty method to retrieve the value of the WebList's html tag property from the Object
'Repository.

ListTag = Browser("Advantage Shopping").Page("Advantage Shopping").WebList("categoryListboxContactUs").GetTOProperty("html tag")
' ListTag contains "SELECT"
Note: GetTOProperty differs from the GetROProperty method. GetTOProperty returns the value from the test object's description. GetROProperty returns the current property value of the object in the application during the test run.


No comments:

Post a Comment

Note: only a member of this blog may post a comment.