51Testing软件测试论坛

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

QQ登录

只需一步,快速开始

微信登录,快人一步

查看: 1530|回复: 1
打印 上一主题 下一主题

[原创] 大家帮忙看下 运行Vbscript脚本 自动加载指定脚本包含的插件,运行报错(见内)

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2010-9-20 22:37:59 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
Function Load_Addins(testPath)
        Dim qtApp 'As QuickTest.Application
        Dim blnNeedChangeAddins
        Dim arrTestAddins
        Set qtApp = CreateObject("QuickTest.Application")
        arrTestAddins = qtApp.GetAssociatedAddinsForTest(testPath)
        blnNeedChangeAddins = False
        For Each testAddin In arrTestAddins
            If qtApp.Addins(testAddin).Status <> "Active" Then  (出错在这一步 提示找不到元素)
                blnNeedChangeAddins = True
                Exit For
            End If
        Next
        If qtApp.Launched And blnNeedChangeAddins Then
             qtApp.Quit
        End If
        If blnNeedChangeAddins Then
            Dim blnActivateOK
            blnActivateOK = qtApp.SetActiveAddins(arrTestAddins, errorDescrīption)
            If Not blnActivateOK Then
                Call ErrorLog(errorDescrīption)  '这里是调用自己的日志函数,可替换为自己的或注释掉
                  Wscrīpt.Quit
            End If
        End If
        If Not qtApp.Launched Then
            qtApp.Launch
        End If
        qtApp.Visible = True
        qtApp.Open testPath
'可在此加入qtApp.Test.Run来运行Test
        Set qtApp = Nothing
End Function
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

该用户从未签到

2#
发表于 2010-9-21 11:18:00 | 只看该作者
可以啊,没错
回复 支持 反对

使用道具 举报

本版积分规则

关闭

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

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

GMT+8, 2024-5-22 15:51 , Processed in 0.068247 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2024 Comsenz Inc.

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