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