PhantomJS - onInitialized()



该回调在页面被调用但在其加载之前调用。

语法

其语法如下 −

page.onInitialized = function() {} 

示例

var wpage = require('webpage').create(); 
wpage.onInitialized = function() { 
   console.log('File is initialized');  
} 
wpage.open("https://127.0.0.1/tasks/file.html", function(status) { 
   console.log(status);  
}); 

以上程序生成以下 输出

Success
File is initialized
phantomjs_webpage_module_events_callbacks.htm
广告