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 = {
WebDriverManager.chromedriver().arch32().setup()
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
options.addArguments("disable-infobars")
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
https://scrum-master.de
--
Alexander Kriegisch
https://scrum-master.de
[email protected] schrieb am 09.07.2021 20:06 (GMT +07:00):
hi,do you have any suggestion how to include this https://stackoverflow.com/questions/25431380/capturing-browser-logs-with-selenium-webdriver-using-java/26488661 into the framework to get chrome browser console logs?as thisLoggingPreferences 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()--
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 [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/geb-user/3cb94fa7-e8f6-4246-91ec-64c94561ce69n%40googlegroups.com.
--
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 [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/geb-user/20210712042507.07B6C1B4053C%40dd19710.kasserver.com.
