Programmatically access mixed-content warnings/errors

134 views
Skip to first unread message

renzokuken

unread,
Sep 13, 2017, 4:41:26 AM9/13/17
to Google Chrome Developer Tools
Hello.

(I've also asked this on headless-dev chromium list but I realized this might really belong here).

As the title says, I want to programmatically get access to mixed content warnings and errors thrown in the console when visiting a page. I've learned about `window.onerror` but AFAIK it can't catch such errors/warnings this way.

I thought that since I can communicate with a headless Chrome instance via the DevTools protocol (`--remote-debugging-port`), there could be a way to use the protocol to determine if any errors/warnings were displayed in the DevTools console and access them programmatically. Is this possible?

Thanks in advance.

PhistucK

unread,
Sep 13, 2017, 4:45:18 AM9/13/17
to Google Chrome Developer Tools
I assume that if the error is displayed in the console of the Developer Tools, it would be sent through the debugging protocol as well. Is that not the case for you?
Do you get normal console.logs and not those errors?


PhistucK

--
You received this message because you are subscribed to the Google Groups "Google Chrome Developer Tools" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-chrome-developer-tools+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-chrome-developer-tools/0dbd1606-b4ca-489d-a71d-153cf905d54d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Kayce Basques

unread,
Jan 8, 2018, 5:48:51 PM1/8/18
to Google Chrome Developer Tools
Lighthouse (LH) has an audit that fails if any errors or logged to the Console.

Maybe you can run the Node module version of LH and just piggyback off of the results of that audit, or you can dig into the LH source to figure out how they're doing it. They're probably using the DevTools Protocol.
Reply all
Reply to author
Forward
0 new messages