TAGS :Viewed: 4 - Published at: a few seconds ago

[ is it possible to use variable in Object Declaration in UFT ]

I have a command link below in UFT/QTP

Set oElement = oDUT.MNativeElement("by:=xpath","identifier:=" & vFinalProperty)

is it possible to assign "oDUT.MNativeElement" to a variable and execute the line.

Answer 1

Yes you can do this and then (as in your example) you would refer to oElement in the future when you needed to refer to it. This is no different to defining a Browser object and referring to it later on. If it's Set as an object reference it's fine.

For example:

oElement.Click ' will send a Click event (if available for this object type) to the oDUT.MNativeElement object