PhantomJS url 属性用法


发布日期 : 2019-10-15 12:30:16 UTC

访问量: 9 次浏览

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