PhantomJS - URL 属性



此属性返回当前页面 URL。

语法

其语法如下 −

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

示例

以下示例演示了 URL 属性的用法。

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

以上程序生成以下 输出

https:///tasks/ptitle.html 
phantomjs_webpage_module_properties.htm
广告
© . All rights reserved.