访问量: 9 次浏览
该属性返回当前页面的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