我在玩Node.js和可用的节点幻像模块。但我似乎在基本层面上被卡住,并不能得到这个代码基础件工作:Node.js和幻影问题
var phantom = require('phantom');
phantom.create(function(ph) {
return ph.createPage(function(page) {
return page.open("http://www.google.com", function(status) {
console.log("opened google? ", status);
return page.evaluate((function() {
return document.title;
}), function(result) {
console.log('Page title is ' + result);
return ph.exit();
});
});
});
});
我真的不能明白,为什么控制台消息不会出现?我想,这恰好在某个幻像范围内,但是我可能会将这些消息解析到节点上吗?还是问题完全是其他问题?
也许没有加载幻象..你尝试之后 phantom.create(函数(PH){或pH值的console.log。 createPage(function(page){ – ZimSystem 2013-03-26 15:11:50
)还要确保在幻像需要的库中没有x86_64与i686的不匹配。请参阅我的答案:http://stackoverflow.com/questions/17002351/node-phantom -createpage-never-calls-callback/17137960#17137960 – hoonto 2013-06-16 21:56:02