PhantomJS - switchToParentFrame()



採用當前子框架的父框架。

語法

其語法如下所示 −

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

示例

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

上述程式生成以下輸出

page2
phantomjs_webpage_module_methods.htm
廣告
© . All rights reserved.