QTP 常用的函数2
上一篇 / 下一篇 2009-02-27 15:48:15 / 个人分类:qtp
1.GetCellData函数
51Testing软件测试网#Tl~L*i0QflC
51Testing软件测试网*R$|&w v?o0A51Testing软件测试网B uh.OoDP Bg
/@~EIbu ^051Testing软件测试网{;by4C6\U-r[
o*|u'J`+@l/s2N0 作用:获取单元格的值
(B-ZJp*Pcd0O^qn;u"L0 例:
rowCount = Browser("xxx ").Page("xxx ").Frame("xxx").WebTable("xxx").RowCount51Testing软件测试网 eOQ;|o%y6QX For counter = 1 To rowCount (NWury c~wCk0 text = Browser("xxx").Page("xxx").Frame("xxx").WebTable("xxx").GetCellData(counter,1) 4W$W[ _ Zam0 If (text = "xxx") Then 2wUo'_5SK#O0 counter = counter - 1 5i h\ E*sq0xo0 selectNO = "#" & counter51Testing软件测试网Ik7TRV Browser("xxx").Page("xxx").Frame("xxx").WebRadioGroup("xxx").Select selectNO 7]f Nx4cp SLo^0 Exit For51Testing软件测试网3C:T0f.Xm/Y End If51Testing软件测试网3@3Pd4CQ9` Fp Next |
GKYC g0 2.把值插入datatable里51Testing软件测试网OVL2Av%d0{F
1FYA#p!B }0 例:
datatable.setcurrentrow(i) :J*L5s.f*u2Tc0 datatable.value("name","Global")="name" m\ u6Q i$E8K L!^0 datatable.value("passwd","Global")="passwd" |
3.用代码来启动浏览器
Browser1 = "IE" ,Qm Ffv0 StartURL = "www.51testing.com" {;f/d~&|SK|0 IF Browser1 = "IE" THEN51Testing软件测试网.k#Ks1|'es set IE = CreateObject("InternetExplorer.Application") z|s!XxmMd0 IE.Visible = true51Testing软件测试网 x G4`|!Rp%C IE.Navigate StartURL51Testing软件测试网:uY(K0e7W9m dR END IF |
4.ExecuteFile函数
$Nk+m&j&nWN4HT051Testing软件测试网'{-F;D#m a U XG%a.z 作用:ExecuteFile 可以直接执行vbs文件,而不需要将其导入resource中
F'R&`t F5k0 ExecuteFile FileName51Testing软件测试网-irH;]$\0a6E0y)yS%D
说明:where FileName is the absolute or relative path of your VBscrīpt file.51Testing软件测试网 fl(N&s1m
w| |a.F0 例:ExecuteFile("F:\test.vbs")51Testing软件测试网1gwO!Pl*u