如何使用qtp验证是否选择了给定的winobject文本

时间:2016-08-22 04:34:25

标签: qtp

我尝试使用:

Window("x").Winobject("y").GetRoProperty("selText")

但是没有输出,SelText {{1}}是有效的属性。

2 个答案:

答案 0 :(得分:0)

您链接到的网站会描述VbEditor测试对象,但您使用的WinObject具有不同的受支持属性列表。

通常,每个测试对象都支持不同的属性列表(尽管有些属性对许多对象是通用的),您应查阅文档以查看支持哪些属性。

据我所知,无法获取WinObject控件的选定文本。如果UFT的 VB Addin 支持您的应用程序,则应在UFT启动时尝试在插件管理器中启用它,否则我不知道在UFT中这样做的方法。

答案 1 :(得分:0)

在选择之前和之后,您是否尝试过文件/图像比较?

WpfWindow("HP MyFlight Sample Application").WpfEdit("byNumberWatermark").CaptureBitmap "C:\Before.png",True
WpfWindow("HP MyFlight Sample Application").WpfRadioButton("byNumberRadio").Set
WpfWindow("HP MyFlight Sample Application").WpfEdit("byNumberWatermark").CaptureBitmap "C:\After.png",True
Set imageCompare = CreateObject("Mercury.FileCompare")
returnValue = imageCompare.IsEqualBin("C:\Before.png","C:\After.png",1,1)
If returnValue = 1 Then
    Msgbox "Both images are Same"
Else
    Msgbox "Both images are not same"
End If

isEqualBin参数3和4解释了Const FC_DIFF_SIZE = 1

在你的情况下,它将是之前和之后选择winobject。