node-horseman: `Unhandled reject Error: Failed to load url` when using SlimerJS
When using Horseman with SlimerJS the following error is returned:
> horseman phantom created +637ms
horseman phantom version 1.9.8 +147ms
horseman page created +154ms
horseman phantomjs onLoadFinished triggered +117ms [ 'success', 'about:blank', false ] NaN
horseman .close(). +6ms
Unhandled rejection Error: Failed to load url
at checkStatus (/Users/user/Projects/project/node_modules/node-horseman/lib/index.js:276:16)
at tryCatcher (/Users/user/Projects/project/node_modules/bluebird/js/release/util.js:16:23)
at Function.Promise.attempt.Promise.try (/Users/user/Projects/project/node_modules/bluebird/js/release/method.js:39:29)
at Object.loadFinishedSetup [as onLoadFinished] (/Users/user/Projects/project/node_modules/node-horseman/lib/index.js:274:43)
at /Users/user/Projects/project/node_modules/node-phantom-simple/node-phantom-simple.js:636:30
at Array.forEach (native)
at IncomingMessage.<anonymous> (/Users/user/Projects/project/node_modules/node-phantom-simple/node-phantom-simple.js:617:17)
at emitNone (events.js:72:20)
at IncomingMessage.emit (events.js:166:7)
at endReadableNT (_stream_readable.js:905:12)
at nextTickCallbackWith2Args (node.js:478:9)
at process._tickDomainCallback (node.js:433:17)
The following test case will reproduce it:
const Horseman = require('node-horseman');
const config = {
browser: {
clientScripts: [],
timeout: 5000,
interval: 50,
loadImages: true,
switchToNewTab: false,
// no support from SlimerJS cookiesFile: null,
// no support from SlimerJS ignoreSSLErrors: false,
sslProtocol: 'any',
// no support from SlimerJS webSecurity: true,
injectJquery: true,
injectBluebird: false,
bluebirdDebug: false,
// no support from SlimerJS proxy: null,
// no support from SlimerJS proxyType: null,
// no support from SlimerJS proxyAuth: null,
phantomPath: '/usr/local/Cellar/slimerjs/0.10.0/bin/slimerjs',
debugPort: null,
debugAutorun: true,
},
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/600.4.10 (KHTML, like Gecko) Version/8.0.4 Safari/600.4.10',
}
const horseman = new Horseman(config.browser);
horseman
.userAgent(config.userAgent)
.open('http://google.co.uk/')
.screenshot('google.jpg')
.close();
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 17 (1 by maintainers)
Commits related to this issue
- Workaround for #180 See [#180](https://github.com/johntitus/node-horseman/issues/180) for the bug report and information on the workaround. — committed to winghouchan/node-horseman by winghouchan 8 years ago
Hey @minhchu this definitely deseveres a new thread. I was able to reproduce the case you posted above.
Also please consider posting all the output, not just the lines describing the error because the lead-up to the error is also very important.
Closing since this is a node-phantom-simple issue and not a horseman one.
See baudehlo/node-phantom-simple#147 for my proposed fix, if you care.