51Testing软件测试论坛

标题: errors when programming QTP automation scripts in javascript [打印本页]

作者: josephwang    时间: 2006-8-7 17:49
标题: errors when programming QTP automation scripts in javascript
Hi experts,
Have you ever used javascript to program QTP automation scripts. Here is a strange problem I encountered.
the method SetActiveAddins of Applicaiton object always throws an error: "invalid procedure call or parameters". The java script is like the following:

var qtApp = new ActiveXObject("QuickTest.Application");
var d = new Array("Web","Oracle");
qtApp.SetActiveAddins(d);
qtApp.Launch();
......

But if I write this in VB script, it works fine. The VB script is like the following:

Dim qtApp
Set qtApp = CreateObject("QuickTest.Application")
qtApp.SetActiveAddins Array("Web","Oracle")
qtApp.Launch
......

how did this happen? BTW the GetAssociatedAddinsForTest method of Applicaiton object also works abmormal.
Need you help
Thanks
作者: QA_BAY    时间: 2006-8-8 10:26
如果VBS运行没有错的话,那就有可能是你JavaScript 语法问题,你可以问开发你写的语法对不对,
你必须保存成JS文件,然后用HTML引用它看看!
以下是JavaScript
var qtApp = new ActiveXObject("QuickTest.Application");
var d = new Array("Web","ActiveX");
qtApp.SetActiveAddins(d);
qtApp.Launch();
qtApp.Visible = true;

...

qtApp.Options.Run.ViewResults = false;

qtApp.open("D:\QTPtest\produ_login", true);
......




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2