JS一个事件多个Function导致语句未完成超时错误
上一篇 /
下一篇 2011-09-05 14:32:56
/ 个人分类:积累经验
原帖:http://bbs.51testing.com/thread-499379-1-1.html
web页面有一个如下的checkbox事件
<input type="checkbox" name="txtAnnuity" class="content"5onclick1=T"AnnuityAction(true)e;UpdateCalc()s;UpdateSave()t;">
//以上代码做过特殊处理,不然BBS不然上传= =
自动化代码如下: getPage("").getElement("").checkboxOperation ("No") ’取消checkbox选中状态 hasAlert "Microsoft Internet Explorer", "确定" ‘调用hasAlert方法,模拟用户点击弹出 alert窗口的“确定”按钮
问题如下: TesterAction(true)会弹出alert框,alert框没消失前不会执行UpdateCalc();UpdateSave(); 而在这一行TesterAction(true)的alert对话框没确定或者取消之前,UpdateCalc();UpdateSave();无法被执行
因为UpdateCalc();UpdateSave();无法被执行,则该getPage("").getElement("").checkboxOperation ("No")语句未完成,程序会继续等待.. 直到超时...
解决如下:
|
VBA调用函数- Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
- 'Author:
- 'Create Data:
- 'Description: OpenScript. to close Window
- Public Sub OpenScript(DirScriptName)
- Dim ScriptName As String
- ScriptName = getLocalPath + DirScriptName ' this is AU3Script. Path
- ShellExecute 0, vbNullString, ScriptName, vbNullString, vbNullString, vbNormalFocus
- End Sub
复制代码
脚本代码如下:- WinWait("Microsoft Internet Explorer", "") ; Pauses execution of the script. until the requested window "Microsoft Internet Explorer" exists.
- If Not WinActive("Microsoft Internet Explorer", "") Then WinActivate("Microsoft Internet Explorer", "")
- WinWaitActive("Microsoft Internet Explorer", "");WinActive window "Microsoft Internet Explorer"
- ControlClick("Microsoft Internet Explorer", "", "[CLASS:Button;INSTANCE:1]","left",1); Click Button which is "INSTANCE:1"
复制代码
收藏
举报
TAG: