PhantomJS ``switchToFrame()`` 用法:定位并切换到子框架


发布日期 : 2020-06-25 16:10:32 UTC

访问量: 10 次浏览

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