根据您的评论,我猜您有2个选择
- 尝试找到phantomjs节点模块-https: //github.com/amir20/phantomjs-node
- 运行phantomjs作为一个子进程内部节点- http://nodejs.org/api/child_process.html
编辑:
phantomjs似乎建议子进程作为与节点交互的一种方式,请参见常见问题解答-http:
//pre.google.com/p/phantomjs/wiki/FAQ
编辑:
用于获取页面HTML标记的示例Phantomjs脚本:
var page = require('webpage').create(); page.open('http://www.google.com', function (status) { if (status !== 'success') { console.log('Unable to access network'); } else { var p = page.evaluate(function () { return document.getElementsByTagName('html')[0].innerHTML }); console.log(p); } phantom.exit();});


