访问量: 10 次浏览
switchToMainFrame()switchToMainFrame() 方法选择主框架,即根窗口。
其语法如下所示−
var wpage = require('webpage').create();
wpage.switchToMainFrame();
var page = require('webpage').create();
page.open('http://localhost/tasks/frames.html', function(status) {
page.switchToMainFrame();
console.log(page.frameName);
});
它将产生以下输出。
page2