Action脚本怎么用function实现以及Sub
'-------------------脚本说明---------------'产品版本:QBPM(V1.0)
'测试员:Anna
'编写日期:2013-05-17
'测试功能:登陆
'脚本类型:VBS
'被测试对象初始状态:
'进展程度:第一阶段
'--------------------脚本内容-------------
'通过读取Excel数据登录系统
Dim i,rowcount,filepath
filepath = "d:\data\login.xls"
datatable.AddSheet("TestData")
datatable.ImportSheet filepath,"Sheet1","TestData"
rowcount = datatable.GetSheet("TestData").GetRowCount
'Function getExcelDataInfo(filepath,rowcount,DataTable)
' DataTable.AddSheet("TestData")
' DataTable.ImportSheet filepath,"Sheet1","TestData"
' rowcount = datatable.GetSheet("TestData").GetRowCount
'End Function
With Browser("业务流程管理系统登录页面")
For i = 1 to rowcount
datatable.SetCurrentRow i
UserName = datatable("username","TestData")
PassWord = datatable("password","TestData")
With .Page("业务流程管理系统登录页面")
.WebElement("html id:=bu").Click'请输入用户名
.WebEdit("name:=txt_Username","html id:=txt_Username").Set UserName'用户名
wait 3
.WebElement("html id:=bp").Click'请输入密码
.WebEdit("name:=txt_Password","html id:=txt_Password").SetSecure PassWord'密码
wait 3
.WebButton("登 录").Click
End With
wait 2
With .Dialog("来自网页的消息")
If .WinButton("确定").Exist(7) Then
Reporter.ReportEvent micPass,"登录失败","Display"
.WinButton("确定").Click
ELSE
Reporter.ReportEvent micPass,"登陆成功","pass"
End If
End With
datatable.SetNextRow '下一行
If datatable.GetCurrentRow > rowcount then'如果当前行大于总行数,退出循环
Exit for
End If
Next
RunAction"创建设备",onelteration
End With 支持LZ的分享~ 回复 1# fsweicaixia
写的不错,登录可以再用个Function封装一下 是的 现在就是不会封装成function或sub
帖子的标题就是:Action脚本怎么用function实现以及Sub
页:
[1]