2

Our selenium grid works fine with Firefox and Chrome nodes. But we cannot get access to the browser logs.

Setup is as follows:

MutableCapabilities options = new FirefoxOptions();
LoggingPreferences preferences = new LoggingPreferences();
preferences.enable(LogType.BROWSER, Level.ALL);
options.setCapability(CapabilityType.LOGGING_PREFS, preferences);

Reading the logs:

if (driver.manage().logs().getAvailableLogTypes().contains(logType)) {
    LogEntries logEntries = driver.manage().logs().get(logType);
    for (LogEntry entry : logEntries) {
        System.out.println(
                String.format(
                        "%s: %s [%s] %s",
                        logType,
                        new Date(entry.getTimestamp()),
                        entry.getLevel(),
                        entry.getMessage()
                )
        );
    }
} else {
    // print error message if not available
}

Unfortunately getAvailableLogTypes contains only 'server' and 'client' but not the browser logs. Are we missing any configuration on the firefox/chrome nodes to enable these?

pintxo
  • 2,085
  • 14
  • 27

0 Answers0