简体   繁体   English

是否可以在UFT的对象声明中使用变量

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

I have a command link below in UFT/QTP 我在UFT/QTP有一个命令链接

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

is it possible to assign "oDUT.MNativeElement" to a variable and execute the line. 是否可以将"oDUT.MNativeElement"分配给变量并执行该行。

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. 是的,您可以执行此操作,然后(如您的示例所示)将来在需要引用oElement时将其引用。 This is no different to defining a Browser object and referring to it later on. 这与定义Browser对象并在以后引用它没有什么不同。 If it's Set as an object reference it's fine. 如果将其Set为对象引用就可以了。

For example: 例如:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM