awesome-chrome-devtools icon indicating copy to clipboard operation
awesome-chrome-devtools copied to clipboard

Capture Console?

Open johnaweiss opened this issue 4 years ago • 5 comments

Beginner question:

Is it possible to capture all chrome console messages using javascript? This would be a stand-alone chrome browser, not headless. Running inside the same browser-instance-- not a client/remote browser.

What's the simplest, most lightweight solution?

thx!

johnaweiss avatar May 23 '20 11:05 johnaweiss

I don't believe there is any exposure to intercept those messages. What is your use-case for needing such a feature?

Garbee avatar Jun 02 '20 14:06 Garbee

Display them on a front-end IDE, embedded in a webpage, using the local JS engine. 

johnaweiss avatar Jun 02 '20 15:06 johnaweiss

IDEs tend to connect using remote debugging which allows API access via the Chrome DevTools Protocol. That way your IDE is the debugger for the app rather than having DevTools open and your IDE. That's how they tend to get access to the logs.

Would using the remote debugging setup not work for some reason?

Garbee avatar Jun 02 '20 16:06 Garbee

I had a similar problem. My solution was to edit the console functions: https://github.com/Yash-Singh1/zoom.js/blob/master/test/auto.js#L3

Yash-Singh1 avatar Jan 29 '21 20:01 Yash-Singh1