Selenium - Chrome Performance Logs not Working
For anyone coming to this recently - in recent Selenium and ChromeDriver versions (eg 3.14.159, chrome driver 76.x) setting up loggingPrefs with ChromeDriver doesn't seem to work, using the local ChromeDriver - no matter what you do you seem to get the log type 'performance' not found
error
The reason is increasingly strict w3c spec compliance, both in Selenium and ChromeDriver code.
Instead of the loggingPrefs/CapabilityType.LOGGING_PREFS
capability, you need to use goog:loggingPrefs
, like so
ChromeOptions options = new ChromeOptions(); LoggingPreferences logPrefs = new LoggingPreferences(); logPrefs.enable( LogType.PERFORMANCE, Level.ALL ); options.setCapability( "goog:loggingPrefs", logPrefs );
I guess that sooner or later the Selenium side will notice this and change the CapabilityType.LOGGING_PREFS constant or add a new one, but the project didn't look very friendly to log an issue with to me.
From https://github.com/seleniumhq/selenium-google-code-issue-archive/issues/8386 by @Kiril S,This seems to only happen when using RemoteWebDriver. Using a pure ChromeDriver object will work.