|
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 |
|