PhantomJS - switchToParentFrame()

它采用当前子框架的父框架。

语法

其语法如下 −

var wpage = require('webpage').create();
wpage.switchToParentFrame();

示例

var page = require('webpage').create(); 
page.open('http://localhost/tasks/frames.html', function(status) { 
   page.switchToParentFrame(); 
   console.log(page.frameName); 
}); 

上述程序生成以下输出。

page2

phantomjs_webpage_module_methods.html