public DesiredCapabilities getCapabilities() {
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
ChromeOptions chromeOptions = this.configuredOptions();
LoggingPreferences logPrefs = this.configuredLoggingPrefs();
capabilities.setCapability("chromeOptions", chromeOptions);
capabilities.setCapability("loggingPrefs", logPrefs);
String chromeSwitches = this.environmentVariables.getProperty(ThucydidesSystemProperty.CHROME_SWITCHES);
capabilities.setCapability("chrome.switches", chromeSwitches);
AddCustomCapabilities.startingWith("chrome.capabilities.").from(this.environmentVariables).to(capabilities);
return capabilities;
}
private LoggingPreferences configuredLoggingPrefs() {
LoggingPreferences logPrefs = new LoggingPreferences();
logPrefs.enable("browser", Level.ALL);
logPrefs.enable("performance", Level.ALL);
return logPrefs;
}
Note: LoggingPreferences were not able capture the fetch() api calls. If someone figures out how to make that work, that would be awesome.