我正在为selenium编写用户扩展.我有文件对象.如何获取包含我的文档的窗口的窗口对象?
PageBot.prototype.locateElementByMyLocator= function(text, inDocument) {
// I want the window here
}
解决方法:
在IE中它是document.parentWindow;在Mozilla中它是document.defaultView.
因此你可以做类似的事情
function getDocWindow(doc) {
return doc.parentWindow || doc.defaultView;
}