回放时,鼠标定位总是失败
录制了一个login功能,循环时,总是在鼠标定位的地方卡住,运行不了。把鼠标定位方式改为键盘快捷方式,就可以正常运行了。但是脚本中红色的部分仍然不能通过。请问这是什么原因?
以下是我的脚本:
'$Include "sqautil.sbh"
Sub Main
Dim Result As Integer
Dim pool As Long
Dim pool_result As long
Dim ac as String
Dim pwd as String
Dim frame as String
Dim count as Long
Dim num as Long
'Initially Recorded: 2006-4-49:38:19
'Script Name: login_alert_1
pool=SQADatapoolOpen("test",FALSE,SQA_DP_SEQUENTIAL,FALSE)
pool_result=SQADatapoolFetch(pool)
Window SetContext, "Class=Shell_TrayWnd", ""
StartBrowser "http://192.168.0.128:9080/kent", "WindowTag=WEBBrowser"
num=0
frame="Type=HTMLFrame;HTMLId=mainFrame"
while pool_result<>sqaDpEOF
count=1
num=num+1
pool_result=SQADatapoolValue(pool,1,ac)
pool_result=SQADatapoolValue(pool,2,pwd)
while count<num
frame=frame+"\;Type=HTMLFrame;HTMLId=mainFrame"
count=count+1
wend
Window SetContext, "WindowTag=WEBBrowser", ""
'Browser SetFrame,frame,""
'Browser NewPage,"HTMLTitle=K.I.X login",""
'EditBox Click, "Type=EditBox;Name=ACTOR_NAME", "Coords=29,18"
'InputKeys ac
'EditBox Click, "Type=EditBox;Name=PASSWORD", "Coords=23,18"
' EditBox Click, "Type=EditBox;Name=ACTOR_CODE", "Coords=29,13"
InputKeys ac+"{TAB}"+pwd+"{ENTER}"
Browser SetFrame,frame,""
'EditBox Click, "Type=EditBox;Name=PASSWORD", "Coords=23,13"
'InputKeys pwd
'PushButton Click, "Type=PushButton;HTMLText=login"
Browser NewPage,"HTMLTitle=kent system",""
HTMLImage Click, "Type=HTMLImage;Name=GoShowReply4", "Coords=47,13" pool_result=SQADatapoolFetch(pool)
wend
pool_result=SQADatapoolClose(pool)
End Sub
[ 本帖最后由 wonder80 于 2006-4-19 15:04 编辑 ] 没有人遇到这种情况吗? HTMLImage是否是动态生成的 HTMLImage 不是动态生成的。 把这句去掉看看
Browser NewPage,"HTMLTitle=kent system","" 不写循环,也不要修改脚本,看回放是否有问题 谢谢各位,我找到原因了。是我的脚本写错了。不好意思!
另外,我还有个问题,
Browser SetFrame,frame,""
Browser NewPage,"HTMLTitle=kent system",""
HTMLImage Click, "Type=HTMLImage;Name=GoShowReply4", "Coords=47,13"
中browser不是定位htmlimage的位置的么?为什么把 Browser NewPage,"HTMLTitle=kent system","" 删掉,仍然可以成功运行呢? Browser NewPage是等待一个新页出现然后再做以后的动作,就好比是waitobject,如果页面出现的速度大于命令的间隔速度当然可以去掉,但不是所有的地方所有的时候都可以.
页:
[1]