求助 一个关于WinEdit 取值问题
SystemUtil.Run "C:\WINDOWS\system32\calc.exe","","C:\WINDOWS\system32","open"Window("regexpwndtitle:=计算器","regexpwndclass:=scicalc").Activate
With Window("regexpwndtitle:=计算器","regexpwndclass:=scicalc")
.WinButton("text:=2","object class:=button").Click
.WinButton("text:= \+","object class:=button").Click
.WinButton("text:=1","object class:=button").Click
End With
For Iterator = 1 To 3 Step 1
Window("regexpwndtitle:=计算器","regexpwndclass:=scicalc").WinButton("text:==","object class:=button").Click
Next
Dim iResult
Set Result=Window("regexpwndtitle:=计算器","regexpwndclass:=scicalc").WinEdit("nativeclass:=Edit","object class:=Edit")
iResult=Cint(Result.GetROProperty("nativeclass:=Edit","object class:=Edit"))
IfiResult=5 Then
Reporter.ReportEvent micPass,"PASS" ,"输出正确"
Else
Reporter.ReportEvent micPass,"NG" ,"输出错误"
End If
Window("regexpwndtitle:=计算器","regexpwndclass:=scicalc").Close
里面的iResult 一直等不到 5 这个数字 只能取到0 说明iResult=Cint(Result.GetROProperty("nativeclass:=Edit","object class:=Edit"))
这个函数只是做了无用功 更本没有得到计算器中最后加的结果5.
不知道是我写错了,还是有什么特殊取法 求教下....:Q 写的有点复杂么能识别干嘛非要用那么多属性,干嘛非要用DP,getro不是你这样用的。。
iResult=cdbl(Window("regexpwndtitle:=计算器").WinEdit("nativeclass:=Edit").GetROProperty("text") GetROProperty里面应该放的是你需要获取的该对象的某一个属性, 不是像LZ这么写的 呵呵!在学习中GetROProperty用法我不太清楚。改成GetROProperty("text") 可以取到值了。至于那个属性取太多,我也不知道为什么取单属性就是识别不出来,所以我才多加了个属性。
页:
[1]