Open imVinayPandya opened 7 years ago
Please post the output when running with DEBUG='horseman*'
set.
i got this
horseman using PhantomJS from $PATH +0ms
horseman .setup() creating phantom instance 1 +8ms
horseman phantom created +267ms
horseman phantom version 2.1.1 +41ms
horseman page created +11ms
horseman phantomjs onLoadFinished triggered success NaN +13ms
horseman injected jQuery +31ms
horseman .userAgent() set Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0 +20ms
horseman .open() http://github.com +0ms
horseman phantomjs onLoadFinished triggered success 1 +6s
horseman injected jQuery +25ms
horseman .title() +6ms
horseman .close(). +17ms
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 /home/vinay/headless-browser-login/node_modules/node-horseman/lib/actions.js:989:36
at tryCatcher (/home/vinay/headless-browser-login/node_modules/bluebird/js/release/util.js:16:23)
at Function.Promise.fromNode.Promise.fromCallback (/home/vinay/headless-browser-login/node_modules/bluebird/js/release/promise.js:180:30)
at Horseman.<anonymous> (/home/vinay/headless-browser-login/node_modules/node-horseman/lib/actions.js:987:29)
at Horseman.tryCatcher (/home/vinay/headless-browser-login/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/home/vinay/headless-browser-login/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/home/vinay/headless-browser-login/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromiseCtx (/home/vinay/headless-browser-login/node_modules/bluebird/js/release/promise.js:606:10)
at Async._drainQueue (/home/vinay/headless-browser-login/node_modules/bluebird/js/release/async.js:138:12)
at Async._drainQueues (/home/vinay/headless-browser-login/node_modules/bluebird/js/release/async.js:143:10)
at Immediate.Async.drainQueues (/home/vinay/headless-browser-login/node_modules/bluebird/js/release/async.js:17:14)
at runCallback (timers.js:651:20)
at tryOnImmediate (timers.js:624:5)
at processImmediate [as _immediateCallback] (timers.js:596:5)
I could have sworn I commented on this issue a while back.
Anyways, it works with GitHub for me with PhantomJS 1 but not with PhantomJS 2. I do not have time to debug in detail, but it is likely related to the Unrecognized Content-Security-Policy directive
console messages. Your log does not seem to have the verbose messages on, so I included the output I got when I ran your GitHub code.
You could just use PhantomJS 1, or maybe this comment will be of some help to you in figuring out what is going wrong with PhantomJS 2.
$ DEBUG='horseman*' BLUEBIRD_DEBUG=1 node i271.js
horseman using PhantomJS from phantomjs-prebuilt module +0ms
horseman .setup() creating phantom instance 1 +5ms
horseman phantom created +958ms
horseman phantom version 2.1.1 +30ms
horseman page created +15ms
horseman phantomjs onLoadFinished triggered success NaN +16ms
horseman injected jQuery +30ms
horseman .userAgent() set Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0 +17ms
horseman .open() http://github.com +2ms
horseman:verbose onConsoleMessage Unrecognized Content-Security-Policy directive 'base-uri'.
line: undefined in undefined 1 +2s
horseman:verbose onConsoleMessage Unrecognized Content-Security-Policy directive 'form-action'.
line: undefined in undefined 1 +0ms
horseman:verbose onConsoleMessage Unrecognized Content-Security-Policy directive 'frame-ancestors'.
line: undefined in undefined 1 +3ms
horseman phantomjs onLoadFinished triggered success 1 +1ms
horseman injected jQuery +12ms
horseman .title() +6ms
(node:26267) Warning: a promise was rejected with a non-error: [object Object]
horseman .close(). +19ms
(node:26267) Warning: a promise was rejected with a non-error: [object Object]
(node:26267) Warning: a promise was rejected with a non-error: [object Object]
Unhandled rejection eval@[native code]
evaluatePage
global code
evaluateJavaScript@[native code]
evaluate
at /home/awlayton/source/node-horseman/lib/actions.js:989:36
at Horseman.<anonymous> (/home/awlayton/source/node-horseman/lib/actions.js:987:29)
at runCallback (timers.js:672:20)
at tryOnImmediate (timers.js:645:5)
at processImmediate [as _immediateCallback] (timers.js:617:5)
From previous event:
at Horseman.evaluatePage (/home/awlayton/source/node-horseman/lib/actions.js:984:20)
at Horseman.exports.__evaluate (/home/awlayton/source/node-horseman/lib/actions.js:973:22)
at Horseman.(anonymous function) [as __evaluate] (/home/awlayton/source/node-horseman/lib/index.js:414:17)
at Horseman.exports.title (/home/awlayton/source/node-horseman/lib/actions.js:1049:14)
at Horseman.(anonymous function) [as title] (/home/awlayton/source/node-horseman/lib/index.js:414:17)
at Horseman.<anonymous> (/home/awlayton/source/node-horseman/lib/index.js:422:22)
at Horseman.page.loadDone (/home/awlayton/source/node-horseman/lib/index.js:252:13)
From previous event:
at Promise.HorsemanPromise.(anonymous function) [as title] (/home/awlayton/source/node-horseman/lib/index.js:420:15)
at Object.<anonymous> (/home/awlayton/source/node-horseman/i271.js:39:3)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.runMain (module.js:605:10)
at run (bootstrap_node.js:423:7)
at startup (bootstrap_node.js:147:9)
at bootstrap_node.js:538:3
This was useful. Was getting the same error, changing the binary to the Phantom1 ended up working.
Looks related: https://github.com/ariya/phantomjs/issues/13114
Just ran into this issue myself... even attempting a .click() will trigger the error. :\
i want to keep it simple
this code is working fine
and this code is not working