首页 测试 工具 查看内容

QTP之无分页功能的查找脚本

2014-9-6 17:56| 发布者: | 查看: 566| 评论: 0

摘要:   完全匹配查找,即所查找的列必须与关键字的字段一致,如果某一行不一致,则退出fail For i=2 to totalRowNumber   获取某列的值 text1=Browser(" ").Page(" ").Frame("name:=RightBottomFrame").WebTa ...
For i=2 to totalRowNumber

  获取某列的值

text1=Browser(" ").Page(" ").Frame("name:=RightBottomFrame").WebTable("class:=CommonTable CommonSubTable BugMode").GetCellData(i,2)

  如果没有trim()方法,老是报错,不晓得为啥子,仔细看text1里面也没有空格

If  trim(text1)=trim(checkTest1) Then
check=true
else
check=false
i=totalRowNumber
End If
Next

  模糊查找,使用qtp自带函数RegExpTest(),经试验这里的检查作用相当于模糊查询了,不需要自己再构造正则表达式,只要存在checkTest2则返回,否则为空

For j=2 to totalRowNumber

  获取某列的值

text2=Browser(" ").Page(" ").Frame("name:=RightBottomFrame").WebTable("class:=CommonTable CommonSubTable BugMode").GetCellData(j,3)
If  RegExpTest(checkTest2,text2)<>""  Then
check=true
else
check=false
i=totalRowNumber
end if
Next
If check=true Then
CloseMsgByTime "pass"
else
CloseMsgByTime "fail"
End If
Browser(" ").Page(" ").Sync
Browser(" ").CloseAllTabs

版权声明:本文出自qwen的51Testing软件测试博客,欢迎转载......

  完全匹配查找,即所查找的列必须与关键字的字段一致,如果某一行不一致,则退出fail


鲜花

握手

雷人

路过

鸡蛋

扫一扫关注最新动态

毒镜头:老镜头、摄影器材资料库、老镜头样片、摄影
爱评测 aipingce.com  
返回顶部