PhantomJS - title 属性

此属性返回您正在阅读的页面的标题。

语法

其语法如下 −

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

示例

以下示例显示了 title 属性的用法。

var wpage = require('webpage').create(); 
wpage.open('http://localhost/tasks/ptitle.html', function (status) {  
   console.log(wpage.title); 
   phantom.exit(); 
}); 

上述程序生成以下输出

Testing PhantomJs

phantomjs_webpage_module_properties.html