PhantomJS switchToFrame() 选择指定名称的框架,该框架也是当前框架的子框架。 语法 其语法如下所示 – var wpage = require('webpage').create(); wpage.switchToFrame();JavaScriptCopy 示例 var page = require('webpage').create(); page.open('http://localhost/tasks/frames.html', function(status) { page.switchToParentFrame(); page.switchToFrame('myframe'); console.log(page.frameName); });JavaScriptCopy 它将产生以下输出。 MyframeJavaScriptCopy