getting browser logs

Skip to first unread message

Jul 9, 2021, 9:06:10 AM7/9/21
to Geb User Mailing List

do you have any suggestion how to include this into the framework to get chrome browser console logs?

as this 

LoggingPreferences logPrefs = new LoggingPreferences();
logPrefs.enable(LogType.BROWSER, Level.ALL);
caps.setCapability(CapabilityType.LOGGING_PREFS, logPrefs);

gives me an error:

Caused by: groovy.lang.MissingMethodException: No signature of method: org.openqa.selenium.logging.LoggingPreferences.enable() is applicable for argument types: (ConfigObject, ConfigObject) values: [[:], [:]]
Possible solutions: enable(java.lang.String, java.util.logging.Level), any()

Marcin Erdmann

Jul 12, 2021, 4:05:54 PM7/12/21
The error you got suggests to me that you forgot to import LogType.BROWSER and Level.ALL.


You received this message because you are subscribed to the Google Groups "Geb User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit

Alexander Kriegisch

Jul 14, 2021, 2:41:09 AM7/14/21

I tried this in my old Spock 1.3, Selenium 3.14.0, Geb 3.0.1 example project. It seems to work, if I have the right imports in my GebConfig.groovy file and this section for the Chrome browser:

environments {
chrome {
driver = {

LoggingPreferences logPrefs = new LoggingPreferences()
logPrefs.enable(LogType.BROWSER, Level.ALL)
      def options = new ChromeOptions()
options.setCapability(CapabilityType.LOGGING_PREFS, logPrefs)
// Avoid "Chrome is being controlled by automated test software" pop-up
new ChromeDriver(options)
// other drivers
I use an options object and set capabilities on that one, because I am also using options directly. There is no Chrome driver constructor taking both options and capabilities. I guess, you can adjust that to your needs.
Alexander Kriegisch
Reply all
Reply to author
0 new messages