I\'m trying to crawl a webpage using Nightmare, but want to wait for #someelem
to be present, only if it actually exists. Otherwise, I want Nightmare to move on
.wait(selector) Wait until the element selector is present e.g. .wait('#pay-button')
the wait wait works in this case only till the element first becomes visible if it does not then it will work till default timeout of 30s
.wait(function () { return (document.querySelector(selector) === null); })
where selector is the element based on whose existence in the DOM we wait.