***********************************************************************************************************
Dim a,b
a = Window("Flight Reservation").Dialog("Flight Reservations").Static("The information has changed. Save changes?").GetROProperty("text")
b = "The information has changed. Save changes?"
Check_Objects_Text a, b
Window("Flight Reservation").Dialog("Flight Reservations").WinButton("No").Click
Function Check_Objects_Text(realText,strText)
Dim Mycomp
strText = "The information has changed. Save changes?"
Mycomp = StrComp(realText, strText, 1)
msgbox strText
msgbox realText
If Mycomp = 0 Then
Reporter.ReportEvent micPass,"检查字符串是否一致","界面中包含字符串:"&strText
else
Reporter.ReportEvent micFail,"检查字符串是否一致","界面中不包含字符串:"&strText
End If
End Function
*********************************************************************************
另外,本人最近在考虑测窗口标题的VBS,目前只用了exist,但是也想写点类似以上的代码,还希望大家多给宝贵意见。。。作者: hxw_3166 时间: 2010-12-6 10:51
谢谢楼主的抛砖引玉,期待有更多的检查点代码。作者: chipucca 时间: 2010-12-26 20:49 回复 2#hxw_3166
好的,感谢关注!!作者: willturner 时间: 2010-12-27 18:54
Function Check_Objects_Text(realText,strText)
Dim Mycomp
strText = "The information has changed. Save changes?" Mycomp = StrComp(realText, strText, 1)
msgbox strText
msgbox realText
.....
不太明白strText作为函数Check_Objects_Text的第二个参数传入,为什么还要在函数体内部赋静态的字符串值,那这个函数不就只能比较是否realText是不是"The information has changed. Save changes?"作者: shaynechu 时间: 2010-12-28 22:37
其实要实现这个检查功能 只需要第一个参数就行了作者: KateCao 时间: 2011-1-4 16:08
看看,谢谢作者: chipucca 时间: 2011-4-20 19:53 回复 4#willturner