0

我试图在 mozilla js 中获取 MozillaBrowserBot 对象。但它没有给出对象。我使用的代码如下:

function externalApplication(){
        var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator);
        alert("wm: "+wm);
        var contentWindow=wm.getMostRecentWindow('navigator:browser').getBrowser().contentWindow;
        alert("contentWindow: "+contentWindow);

        //I am not gettting this pageBot object
        var pagebot=new MozillaBrowserBot(contentWindow);
        alert(pagebot);
}

我想将 find 选项添加到 xpath 检查器。如果 MozillaBrowserBot 与 selenium IDE 相关,那么是否有可能获取 pagebot 对象?

4

1 回答 1

0

从谷歌搜索结果来看,MozillaBrowserBot是由 Selenium IDE 定义的。此外,它显然是在您获得的内容页面中定义的,而不是在您的代码执行的上下文中。这意味着正确的调用将是:

var pagebot = new contentWindow.MozillaBrowserBot(contentWindow);

这当然是基于一堆猜测,因为您的问题不提供任何上下文信息。

于 2012-08-22T14:48:30.097 回答