K
K
kurispesso2014-06-20 00:20:28
JavaScript
kurispesso, 2014-06-20 00:20:28

How to "ignore" javascript error on page load using PhantomJs?

Using PhantomJs, I am parsing the site page. During page load, PhantomJs loads javascript scripts. During the execution of one of the scripts, an error occurs, and then the required page is not processed correctly and completely.
Everything works fine in the browser, but here is PhantomJs. Maybe someone solved such a problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
oshibka404, 2014-06-25
@oshibka404

If the error itself is not critical, and it is enough to simply ignore it and continue the script execution, then use the try/catch construct.

try {
// код, вызывающий ошибку
} catch(e) {
    console.log(e)
}

javascript.ru/try-catch

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question