I'm using the nightmareJs package (http://www.nightmarejs.org/) and it seems that the website produces an or timeout that isn't captured by the promise and hence the callback is never executed.
Here is the code:
nightmareJs
.goto('https://www.website.org/account')
.type('#username', user)
.type('#password', pass)
.click('#loginButton')
.wait('#indexPage > div > main')
.evaluate(function () {
return document.querySelector('#registeredGuest') !== null;
})
.end()
.then(function (result) {
const ancestryAccountType = result ? 'trial' : 'paid';
const modifierObject = {};
modifierObject.ancestryAccountType = ancestryAccountType;
updateIdentitiesAncestryObj(userId, modifierObject);
return cb();
})
.catch(function (error) {
console.error('Search failed:', error);
return cb(error);
});
Does anyone have an idea how I can catch the exception?