thank you for your answer but unfortunately none of them worked for me, I have managed to come up with a solution for my issue using:
ChromeOptions options = new ChromeOptions();
options.setCapability(ChromeOptions.CAPABILITY, getCap());
WebDriver driver = new ChromeDriver(options);
Alongside with the custom made method:
private static DesiredCapabilities getCap() {
DesiredCapabilities caps = DesiredCapabilities.chrome();
LoggingPreferences logPrefs = new LoggingPreferences();
logPrefs.enable(LogType.PERFORMANCE, Level.INFO);
logPrefs.enable(LogType.PROFILER, Level.INFO);
logPrefs.enable(LogType.BROWSER, Level.INFO);
logPrefs.enable(LogType.CLIENT, Level.INFO);
logPrefs.enable(LogType.DRIVER, Level.INFO);
logPrefs.enable(LogType.SERVER, Level.INFO);
caps.setCapability(CapabilityType.LOGGING_PREFS, logPrefs);
return caps;
}
And finally had to make a filter method as the Selenium one was not working properly for me and was returning all of the entries:
private static List<LogEntry> filterLog(LogEntries entries) {
List<LogEntry> logs = new ArrayList<>();
for (LogEntry entry : entries) {
if(entry.getLevel().toString().equals(INFO)) {
logs.add(entry);
}
}
return logs;
}