QTP函数使用(实战系列三)
作者:互联网
一.用函数实现下拉框检查数值:
Vbs中函数有Sub 与Function ,区别是Sub没有返回值,Function有
Set fly =Window("Flight Reservation").WinComboBox("Fly From:")
Function flyCom(obj)
Dim myArr()
For i = 0 to obj.GetItemsCount -1
ReDim Preserve myArr(i)
myArr(i)= obj.GetItem(i)
Next
flyCom=myArr
End Function
调用该函数,把函数赋值给变量aa,因该函数返回值是数组类型,直接用ubound求出数组大小
aa =flyCom(fly)
for i= 0 to ubound(aa)
msgbox aa(i)
Next
标签:实战,aa,Function,obj,函数,QTP,flyCom,myArr 来源: https://blog.51cto.com/u_11959730/2778130