PhantomJS switchToParentFrame() 获取当前子frame的父frame。 语法 其语法如下所示 − var wpage = require('webpage').create(); wpage.switchToParentFrame();JavaScriptCopy 示例 var page = require('webpage').create(); page.open('http://localhost/tasks/frames.html', function(status) { page.switchToParentFrame(); console.log(page.frameName); });JavaScriptCopy 上面的程序生成以下 输出 。 page2JavaScriptCopy