셀렌에 사용자 확장 기능을 쓰고 있습니다. 나는 document
개체를 가지고있다. 내 문서가 들어있는 창에서 window
개체를 가져 오는 방법은 무엇입니까?javascript/selenium : 문서 객체에서 창 가져 오기
PageBot.prototype.locateElementByMyLocator= function(text, inDocument) {
// I want the window here
}
셀렌에 사용자 확장 기능을 쓰고 있습니다. 나는 document
개체를 가지고있다. 내 문서가 들어있는 창에서 window
개체를 가져 오는 방법은 무엇입니까?javascript/selenium : 문서 객체에서 창 가져 오기
PageBot.prototype.locateElementByMyLocator= function(text, inDocument) {
// I want the window here
}
IE에서는 document.parentWindow; Mozilla에서는 document.defaultView입니다. 당신이 일을 더 나은 방법으로 볼 수는
Selenium.prototype.doExtensionStuff(){
var doc = this.browserbot.getUserWindow().document; //This returns the document that Selenium is using
}
이
를 이동하여 셀레늄의 윈도우 객체를 얻을 수 있습니다 자신의 내선을 작성하는 경우따라서 당신은
function getDocWindow(doc) {
return doc.parentWindow || doc.defaultView;
}
처럼 뭔가를 할 수 Selenium이 다른 브라우저의 불결함을 돌보고 있기 때문에 모든 브라우저에서 작동합니다.
처음부터 어떻게 문서 객체를 얻었습니까? 테스트를 진행하는 동안 가져올 수없는 것 같습니다 ... –