Unhandled rejection click evaluatePage global code error
See original GitHub issueI installed node-horseman and i downloaded phantomjs and set it to environment variable (windows 7 64bit) when I tried to execute
var Horseman = require('node-horseman');
var horseman = new Horseman();
horseman
.userAgent('Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0')
.open('http://www.google.com')
.type('input[name="q"]', 'github')
.click('button:contains("Google Search")')
.keyboardEvent('keypress', 16777221)
.waitForSelector('div.g')
.count('div.g')
.log() // prints out the number of results
.close();
I got the following error
Unhandled rejection click
evaluatePage
global code
evaluateJavaScript@[native code]
evaluate@phantomjs://platform/webpage.js:390:39
phantomjs://code/bridge.js:121:61
at C:\Users\test\Desktop\horse\node_modules\node-horseman\lib\actions
.js:989:36
at tryCatcher (C:\Users\test\Desktop\horse\node_modules\bluebird\js\r
elease\util.js:16:23)
at Function.Promise.fromNode.Promise.fromCallback (C:\Users\test\Desk
top\horse\node_modules\bluebird\js\release\promise.js:176:30)
at Horseman.<anonymous> (C:\Users\test\Desktop\horse\node_modules\nod
e-horseman\lib\actions.js:987:29)
at Horseman.tryCatcher (C:\Users\test\Desktop\horse\node_modules\blue
bird\js\release\util.js:16:23)
at Promise._settlePromiseFromHandler (C:\Users\test\Desktop\horse\nod
e_modules\bluebird\js\release\promise.js:502:31)
at Promise._settlePromise (C:\Users\test\Desktop\horse\node_modules\b
luebird\js\release\promise.js:559:18)
at Promise._settlePromiseCtx (C:\Users\test\Desktop\horse\node_module
s\bluebird\js\release\promise.js:596:10)
at Async._drainQueue (C:\Users\test\Desktop\horse\node_modules\bluebi
rd\js\release\async.js:143:12)
at Async._drainQueues (C:\Users\test\Desktop\horse\node_modules\blueb
ird\js\release\async.js:148:10)
at Immediate.Async.drainQueues [as _onImmediate] (C:\Users\test\Deskt
op\horse\node_modules\bluebird\js\release\async.js:17:14)
at tryOnImmediate (timers.js:534:15)
at processImmediate [as _immediateCallback] (timers.js:514:5)
I even tried using
var phantomjs = require('phantomjs');
var horseman = new Horseman({phantomPath: phantomjs.path});
Issue Analytics
- State:
- Created 7 years ago
- Comments:9
Top Results From Across the Web
Prevent a promise from triggering a global 'unhandled ...
The problem is, certain environments trigger a global event if any promise gets rejected while it has no error handler. Maybe one of...
Read more >Create a Global Promise Rejection Handler | Pluralsight
In the below code, you can see an example of a rejected promise that goes unhandled. 1const myPromise = new Promise( ...
Read more >Unhandled Promise Rejections in Node.js - The Code Barbarian
What is an Unhandled Rejection? "Rejection" is the canonical term for a promise reporting an error. As defined in ES6, a promise is...
Read more >Handling those unhandled promise rejections with JS async ...
You put your code inside an async function in order to use await calls; One of your await ed functions fails (i.e. rejects...
Read more >Creating a JavaScript promise from scratch, Part 7: Unhandled ...
Rejected promises without rejection handlers can hide important errors, which is why both Node.js and browsers have a way of tracking them.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The
.click()
is failing because the selector you tried to click does not exist.Since different versions of PhantomJS throw slightly different errors, it would probably being easier (though kinda wasteful) to have horseman check is the selector is missing and throw an appropriate error @choxi. I would prefer catching the specific error of the selector not existsing, but I do not have the time lately to figure out how. I would be happy to accept a PR doing so though.