我正在编写selenium的用户扩展。我有document
对象。如何获取包含我的文档的窗口的window
对象?
PageBot.prototype.locateElementByMyLocator= function(text, inDocument) {
// I want the window here
}
我正在编写selenium的用户扩展。我有document
对象。如何获取包含我的文档的窗口的window
对象?
PageBot.prototype.locateElementByMyLocator= function(text, inDocument) {
// I want the window here
}
function getDocWindow(doc) {
return doc.parentWindow || doc.defaultView;
}
Selenium.prototype.doExtensionStuff(){
var doc = this.browserbot.getUserWindow().document; //This returns the document that Selenium is using
}
这被视为更好的方法,因为Selenium会处理不同浏览器的难搞问题,任何浏览器都可以使用。