Open dooglio opened 4 years ago
The way to configure the Chrome WebDriver (e.g. to ask it to include info-level logs) seems to be to pass an object like the following under capabilities
in the options object passed to WebDriver.remote()
:
'goog:loggingPrefs': {
browser: 'INFO',
driver: 'INFO',
server: 'INFO',
client: 'INFO'
}
Even though Spectron's API offers a way to amend the options sent to webdriverio (via webdriverOptions
), unfortunately they are applied via Object.assign()
to the top level options object, which means that you can only assign values for top-level keys, overwriting any existing values set by the library. In this case we would need to add a new key+value to options.capabilities
(namely, goog:loggingPrefs
), while retaining existing ones (e.g. the goog:chromeOptions
set by Spectron).
Relevant sources: https://github.com/electron-userland/spectron/blob/c4fe27ec7840ea0468a46ec7ec1b5d69a124b017/lib/application.js#L219
After migrating to Electron 9, and thus to Spectron 11.x, now when I call
getRenderProcessLogs()
the lowest level of log I get isWARNING
from my app. For Spectron 10.x, I always gotINFO
level logs.I made sure the
--verbose
flag is turned on for chrome-driver options, and the webdriver log level defaults toinfo
. There is aloggingPrefs
option in thedesiredCapabilities
in webdriver, but I cannot find a way to set this from Spectron.The upshot is that the internal
getLogs('browser')
now only returns warnings and critical level logs.console.log()
logs no longer show up.I suspect this is due to the migration internally from webdriverio 4.x --> 6.x.