我使用模块node-horseman
从Node运行PhantomJS。我想从github登录页面获取html。这是我的代码。
var Horseman = require('node-horseman');
var horseman = new Horseman();
horseman
.open('https://github.com/login')
.html()
.log()
.close();
但是我得到了错误。
Unhandled rejection eval@[native code]
evaluatePage
global code
evaluateJavaScript@[native code]
evaluate@phantomjs://platform/webpage.js:390:39
phantomjs://code/bridge.js:121:61
at /Users/larry/Desktop/repos/getFollower/node_modules/node-horseman/lib/actions.js:989:36
at tryCatcher (/Users/larry/Desktop/repos/getFollower/node_modules/bluebird/js/release/util.js:16:23)
at Function.Promise.fromNode.Promise.fromCallback (/Users/larry/Desktop/repos/getFollower/node_modules/bluebird/js/release/promise.js:178:30)
at Horseman.<anonymous> (/Users/larry/Desktop/repos/getFollower/node_modules/node-horseman/lib/actions.js:987:29)
at Horseman.tryCatcher (/Users/larry/Desktop/repos/getFollower/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/Users/larry/Desktop/repos/getFollower/node_modules/bluebird/js/release/promise.js:504:31)
at Promise._settlePromise (/Users/larry/Desktop/repos/getFollower/node_modules/bluebird/js/release/promise.js:561:18)
at Promise._settlePromiseCtx (/Users/larry/Desktop/repos/getFollower/node_modules/bluebird/js/release/promise.js:598:10)
at Async._drainQueue (/Users/larry/Desktop/repos/getFollower/node_modules/bluebird/js/release/async.js:143:12)
at Async._drainQueues (/Users/larry/Desktop/repos/getFollower/node_modules/bluebird/js/release/async.js:148:10)
at Immediate.Async.drainQueues [as _onImmediate] (/Users/larry/Desktop/repos/getFollower/node_modules/bluebird/js/release/async.js:17:14)
at tryOnImmediate (timers.js:543:15)
at processImmediate [as _immediateCallback] (timers.js:523:5)
我阅读了自述文件,但我无法找到错误的位置。我想可能还有其他一些问题。有谁知道如何解决它?