How to disable printing javascript exceptions on console?
See original GitHub issueI have tried all methods about disable printing exceptions, but console still printed a bunch of javascript exceptions information.
Here is gradle setting:
compile 'net.sourceforge.htmlunit:htmlunit:2.34.1'
Here is my code:
HtmlPage page = webClient.getPage(pageURL);
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
How to quickly and conveniently disable all console.log ...
Redefine the console.log function in your script. console.log = function() {}. That's it, no more messages to console. EDIT: Expanding on Cide's idea....
Read more >Stop Using console.log() In JavaScript | by Harsha Vardhan
This method is used to clear the console. It is often used if the console is clogged with messages/errors. The console will be...
Read more >JavaScript console.error() Method - W3Schools
Definition and Usage. The error() method writes an error message to the console. The console is useful for testing purposes.
Read more >Console | Node.js v19.3.0 Documentation
Creates a new Console with one or two writable stream instances. stdout is a writable stream to print log or info output. stderr...
Read more >JavaScript Console.log() Example – How to Print to the ...
To reset the counter we can use console.countReset() . And, if you want to name the counter to something other than "default", you...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Ok, have done a lot of changes to fix this pain. In theory not it will be sufficient to do
webClient.setJavaScriptErrorListener(new SilentJavascriptErrorListener()); webClient.setCssErrorHandler(new SilentCSSErrorHandler());
As always this requires a build from the latest code. You can have a look at twitter; will inform there if a new snapshot is available.
This is really a pain with the current version. Will cleanup the source and make a new snapshot available soon.