【发布时间】:2015-01-30 05:23:08
【问题描述】:
我已经通过npm install node-phantom 安装了node-phantom,但是当我运行这段代码时,它给出了Cannot find module 'webpage' 这个错误
var webpage = require('webpage').create(),
url = "https://www.example.com/cba/abc",
hrefs = new Array();
webpage.open(url,function(status){
if(status=="success"){
var results = page.evaluate(function(){
$("#endpoints").each(function() {
hrefs.push($(this).attr("href"));
});
return hrefs;
});
console.log(JSON.stringify(results));
phantom.exit();
}
});
【问题讨论】:
-
查看node_module文件夹中是否存在网页模块
标签: javascript jquery node.js phantomjs