|
回复楼上
非常感谢您的回复,但我这里还有有问题,其实我的目的就是设置一个TextCheckpoint,strText是期望结果,obj是被测对象。代码如下:
Dim a
Dim b
Function Check_Objects_Text(obj,strText)
Dim i
Dim Cnt
strText = "The information has changed.Save changes?"
obj = Window("Flight Reservation").Dialog("Flight Reservations").Static("The information has changed.")
txtArray = Split(obj.GetVisibleText(),vbCrLf,-1,1)
Cnt = UBound(txtArray) '取数组上限
For i = 0 to Cnt
If Trim(txtArray(i)) = Trim(strText) Then
'Reporter.ReportEvent micPass,"检查字符串是否一致","界面中包含字符串:"&strText
Msgbox("Pass")
Exit Function
End If
Next
'Reporter.ReportEvent micFail,"检查字符串是否一致","界面中不包含字符串:"&strText
Msgbox("Fail")
End Function
a = obj 'Window("Flight Reservation").Dialog("Flight Reservations").static("The information has changed. Save changes?").GetROProperty("text")
b = strText '"The information has changed. Save changes?"
Check_Objects_Text a,b
报的错是:Object doesn't support this property or method |
|