chromium google-chrome google-chrome-extension javascript selenium

Capturing Chrome extension console logs in Selenium

I have a Chrome extension that calls console.log() in several places for debugging purposes. This output is visible in the Chrome web console. When I run selenium with ChromeDriver and load up the extension, I still see the output in the web console, but I cannot figure out a way to see the extension logs from the selenium script.

Trying driver.get_log('<target>') with any target specified here returns logs from various parts of the selenium-driver-browser stack, but shows nothing from the extension. I’m also setting all log sources to 'ALL' in loggingPrefs, as specified here.

I’ve also tried using this extension to collect console output into the DOM and then try to read the DOM from the selenium script, but it appears that this extension does not (or cannot?) collect logs from other running extensions.

Any help would be much appreciated!