在这里积累学习中的点点滴滴!

QTP脚本中的FOR循环

上一篇 / 下一篇  2009-05-30 14:43:20 / 个人分类:QTP

使用for循环可以一次执行完所有的数据参数51Testing软件测试网4LB!T/u(D]

for循环控制变量从小到大51Testing软件测试网"q?,X}oO @cYF

Dim row

.V |N ^e5g8E`mXj0

Dim StrValue

Xf5Miy5x g:k-G0

 51Testing软件测试网3xm v2w.jn)`Y

row =DataTable.GetSheet("Global").GetCurrentRow  '获得当前运行数据的行数

*WM'M`0uph(l0

 51Testing软件测试网B%I;c.s'u(on

For row =0 to 20

kr DDZ1v-f p0

StrValue=DataTable.RawValue ("p_Textname", "Global")  '获得当前运行行的值参数为参数名,Sheet名称51Testing软件测试网~L8Eg^ } Y~

 

:Yr"wws+b |0

.WebEdit("personForm.personName").Set StrValue    '注意使用参数后不能在使用DataTable方法51Testing软件测试网9}3L ue9q*JZq

.WebButton("确定").Click

@^'\"tyWM0

 

"J6K sb"u_0\Z0

DataTable.SetNextRow  '一次执行所有的数据行因此,执行FOR循环需置为下一行继续执行51Testing软件测试网h"@!RG"J hT

Next

@xAok Z m6C0

 

"A5?*am0P)r!q[ Y/Ms0

Gb*o+`9J4Re|0

for循环控制变量从大到小

)M W0B2N?nbO0

 

p/e[2H$YI3Y4tm0

Dim i 51Testing软件测试网^4t-D0B {;gAE^

Dim strSelectNum

(xHFW|}T0

With Browser("xxxx")51Testing软件测试网!cYR9e.k

With .Page("xxx")

$L4Y ?/m;G0

.WebEdit("userLoginName").Set "summer"

h2P`*i[0

wait(3)51Testing软件测试网!}S8Z h8S:{P

 '   .WebEdit("userPassword").SetSecure "4a1b58fa0198da28ca9cbe8639560eca2f4f9f19fde271b9e0e3"

3tk9\m y%o|%i0

.WebButton("登录").Click51Testing软件测试网/r:FCzV9B$bc7\"f1^a

End With

5D6L/j }^{k0

 

8mS`6b]#v [ Ff0

    For i=9 To 0 STEP -151Testing软件测试网4~i/jt"X F!Q

With .Page("xxx_3")

-? ['l#E4zz(E u9[0

strSelectNum =cstr(i)51Testing软件测试网ko f Lu"eJ?5`"V,}[

.WebRadioGroup("tableRadio").Select strSelectNum51Testing软件测试网+gF$n8\6}K)D

.WebButton("删除").Click51Testing软件测试网/f7n5T/\&E!K4]8z

End With

|/ZGyL5u0

.Dialog("Microsoft Internet Explorer").WinButton("确定").Type  micReturn

$K%E4U3@ v;Zj4c0

Next51Testing软件测试网_|*X;tv!G|$RjE

End With51Testing软件测试网2J/y&Lz _!Y l

 

Y KK|!@%?#I]"n-FJ0

TAG:

 

评分:0

我来说两句

Open Toolbar