0

I have written a web-crawler to test a pre-release website for errors and issues (i.e. missing content type, timeouts, exceptions, redirects).

This morning a colleague asked me to include a check if there was any javascript error on the page...

A pure javascript solution is unlikely -- i.e. detect all JS errors, using JS

What I appear to want to be able to do is capture the javascript console text, ideally via CoreWebView2

1 Answers1

0

If the page logs each exception into an array,

Errors=[] window.onerror = function (msg, url, line) { Errors.push("Caught[via window.onerror]: '" + msg + "' from " + url + ":" + line); return true; };

Then you can just query the Errors and see both the count and the nature of the errors.

You can also push errors from try catch

Ken Lassesen
  • 125
  • 9