51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 2184|回复: 5
打印 上一主题 下一主题

[求助] 脚本里面如何强制退出当前的ACTION

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2009-7-22 13:04:44 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
如题,脚本里面如何退出当前的ACTION啊
我想做个判断,如果当前的OBJECT 不存在的话就等待比如说5分钟,时间到自动退出当前ACTION,而不再抛出说找不到OBJECT 啥的
        Dim DialogWin
        Window("Notepad").Activate
        Set DialogWin = Window("Notepad").Dialog("Font")
'DialogWin.WinButton("OK").Click
        If  Not DialogWin.Exist(1) Then
                Call TimeIt(5)
        End If
                If  DialogWin.Exist(1)  Then
                        DialogWin.WinButton("OK").Click
                        else
                        Msgbox "Error Close PLS"
                   ' I want exit  from here
                End If

        i=1/0
Msgbox " 1 " & Err.Number & " " & Err.Description

Function TimeIt(N)
   Dim StartTime, EndTime,iCnt
   StartTime = Timer
   For iCnt = 1 To N
           wait(1)
   Next
   EndTime = Timer
   TimeIt = EndTime - StartTime
End Function
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

该用户从未签到

2#
 楼主| 发表于 2009-7-22 13:17:15 | 只看该作者

Now is OK

Dim DialogWin
        Window("Notepad").Activate
        Set DialogWin = Window("Notepad").Dialog("Font")
'DialogWin.WinButton("OK").Click
        If  Not DialogWin.Exist(1) Then
                Call TimeIt(2)
        End If
                If  DialogWin.Exist(1)  Then
                        DialogWin.WinButton("OK").Click
                        else
'                        Msgbox "Error Close PLS"
                        ExitAction("Action1")
       
                End If

        i=1/0
Msgbox " 1 " & Err.Number & " " & Err.Description

Function TimeIt(N)
   Dim StartTime, EndTime,iCnt
   StartTime = Timer
   For iCnt = 1 To N
           wait(1)
   Next
   EndTime = Timer
   TimeIt = EndTime - StartTime
End Function

[ 本帖最后由 lijinshui 于 2009-7-22 13:18 编辑 ]
回复 支持 反对

使用道具 举报

该用户从未签到

3#
发表于 2009-7-22 14:16:04 | 只看该作者
ExitAction
即可
,不需要ExitAction("Action1")
回复 支持 反对

使用道具 举报

该用户从未签到

4#
 楼主| 发表于 2009-7-22 15:23:58 | 只看该作者
哦, 恩,
可是,如果有好几个Action的话,当前这个Action有问题的话,退出去,还要执行下一个Action呀,
ExitAction可以吗,
回复 支持 反对

使用道具 举报

  • TA的每日心情
    无聊
    2015-3-12 14:20
  • 签到天数: 1 天

    连续签到: 1 天

    [LV.1]测试小兵

    5#
    发表于 2009-7-22 15:29:45 | 只看该作者
    Exiting an Action
    You can add a line in your script in the Expert View to exit an action before it runs in its entirety. You may want to use this option to return the current value of the action to the value at a specific point in the run or based on the result of a conditional statement. There are four types of exit action statements you can use:

    ExitAction. Exits the current action, regardless of its iteration attributes.
    ExitActionIteration. Exits the current iteration of the action.
    ExitRun. Exits the test, regardless of its iteration attributes.
    ExitGlobalIteration. Exits the current global iteration.

    lz要学会看帮助
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    6#
    发表于 2009-7-22 21:53:54 | 只看该作者
    楼上的回答经典.很多问题帮助里有答案的.
    回复 支持 反对

    使用道具 举报

    本版积分规则

    关闭

    站长推荐上一条 /1 下一条

    小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

    GMT+8, 2024-9-21 14:37 , Processed in 0.080665 second(s), 29 queries .

    Powered by Discuz! X3.2

    © 2001-2024 Comsenz Inc.

    快速回复 返回顶部 返回列表