|
手里没有winrunner写的脚本程序!
传上来一个robot的登陆脚本!
'##############################################
'#
'# 脚本名称 : 登陆
'# 日期 : 2004-7-15
'# 最后修改日期 : 2004-7-15
'# 开发者姓名 : xxxx
'# 被测试软件名称 : xxxxx系统
'# 开发语言 : c#
'# 目的 : 自动登陆
'#
'##############################################
Sub Main
Dim Result As Integer
Dim Status as long
Dim varUserName as String
Dim varPassWord as String
Dim iLen as integer
'Initially Recorded: 2004-7-15 10:52:33 上午
'Script Name: StartOA
StartApplication "C:\Program Files\Uncnet\OAClient\StartClient.exe"
Window SetContext, "Class=WindowsForms.Window.8;Level=2", ""
EditBox Click, "ObjectIndex=2", "Coords=4,10"
Status = SQAGetProperty ("Type=EditBox;ObjectIndex=2", "Text", varUserName)
if Status = 0 then
for iLen = 0 to Len(varUserName)
InputKeys "{DELETE}"
Next iLen
Status = SQAGetProperty ("ObjectIndex=2", "Text", varUserName)
if Status = 0 and len(varUserName) = 0 then
InputKeys "pcl"
Window SetContext, "Class=WindowsForms.Window.8;Level=2", ""
EditBox Click, "ObjectIndex=1", "Coords=9,15"
InputKeys "123"
end if
else
SQALogMessage sqaFail, "无法得到当前用户名", varUserName
Exit sub
end if
GenericObject Click, "Class=WindowsForms.Window.8;ClassIndex=2", "Coords=26,8"
'验证点
End Sub
winrunner提供的脚本例子很有参考价值!可以自己研究一下!
[ Last edited by pcl2004_27 on 2004-7-20 at 11:30 ] |
|