|
在测试登陆的时候,我下面这个脚本只是用户名和密码都正确的情况下的,用户名不正确的时候,会在登陆页面上出现这样一行字“您输入的用户名或者密码不正确”。这行字可以用object data查证到。还有用户名或者密码为空的时候会弹出一个小的页面提示,这个页面我不知道怎么才能验证到,反正异常情况我不会写代码。高手帮帮我啊。
'$Include "sqautil.sbh"
Sub Main
Dim Result As Integer
dim dp_id as long
dim dp_result as long
dim username as string
dim pwd as string
dim i as integer
for i=1 to 2
'Initially Recorded: 2005-6-28 17:54:41
'Script Name: 123
StartApplication """C:\Program Files\Internet Explorer\IEXPLORE.EXE"""
Window SetContext, "Caption=about:blank - Microsoft Internet Explorer", ""
ComboEditBox Click, "ObjectIndex=2", "Coords=75,9"
InputKeys "http://123.com{ENTER}"
Browser NewPage,"HTMLTitle=帐号验证中心",""
dp_id=sqadatapoolopen("OAlog")
call sqadatapoolfetch(dp_id)
call sqadatapoolvalue(dp_id,1,username)
EditBox Left_Drag, "Name=loginName", "Coords=30,4,35,4"
InputKeys username
call sqadatapoolvalue(dp_id,2,pwd)
EditBox Click, "Name=password", "Coords=30,11"
InputKeys pwd
PushButton Click, "Name=提交"
Window SetContext, "Caption=商务系统 - Microsoft Internet Explorer", ""
Window CloseWin, "", ""
next i
sqadatapoolclose(dp_id)
End Sub |
|