1

I am trying to fetch textual properties of an object.In this case I have taken a notepad and trying to fetch properties via below snippet.But my problem is I am able to get all the properties including the properties whose value is an object.How can I restrict the same?

Snippet goes as follow:

Public Function Object_getObjectProperties(oInteraction)
  Set props = aqObject.GetProperties(oInteraction.guiObject, false)
  sProperties = ""
  While props.HasNext
   Set prop = props.Next
   If(sProperties<>"") Then
    sProperties = sProperties + INSTRUCTION_VALUE_SEPARATOR + prop.Name
   Else
    sProperties = prop.name
   End If
  Wend
  Object_getObjectProperties = sProperties
End Function
Srikant Barik
  • 133
  • 2
  • 12

1 Answers1

1

You can check the type of the property value using the GetVarType method. However, the task of fetching properties of an object in a script is unusual. Probably, the actual baseline task you have can be resolved in a better way.

Dmitry Nikolaev
  • 3,803
  • 2
  • 19
  • 23
  • This is working for all the scenarios except one,where my property is PopupMenu and its value is a Null Object ,so when I try to call aqObject.GetVarType(value of the property) showing -Pop up can't be obtained,Possible reason: There was no click that invokes the popup menu. I have put a check point like this : If(aqObject.GetVarType(prop.value)<>9) Then "not to include them in my list",here 9 is the return code for objects. – Srikant Barik Aug 10 '17 at 09:16
  • I figured out a way to resolve this issue.Instead of GetVarType I am using Object.ValueType to get the data type of the property.So in order to filter out Objects from my property list I am validating it against a constant which has integer value of 9 like this. If(prop.ValueType<>9) Then I add the properties if it is not 9. Is this right approach to solve the problem?I referred to the link followed to come up with above solution. https://support.smartbear.com/testcomplete/docs/reference/program-objects/aqobjproperty/valuetype.html – Srikant Barik Aug 10 '17 at 10:55