I have a web crawler and I use phantomjs to parse pages, I want to get the html, but I always get this type of errors in the output before the html code
ReferenceError: Can't find variable: collapse_content_selector
http://staticloads.com/js/toggle.js?v=2013.10.04:135
TypeError: 'undefined' is not a function (evaluating '$('[placeholder]').placeholderLabel()')
how can I stop that
The easiest way is to add an error handler to phantom.onerror or webpage.onerror. These callbacks are invoked when there is a JavaScript execution error (in the page or in your script).