PhantomJS - URL 属性

此属性返回当前页面 URL。

语法

其语法如下 −

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

示例

以下示例显示了 URL 属性的使用。

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

上述程序生成以下输出

http://localhost/tasks/ptitle.html 

phantomjs_webpage_module_properties.html