Skip to content

C# unable to enable performance logging for ChromeDriver #7335

Description

@DiliTrustApplicant

Chrome:Version 75.0.3770.100
ChromeDriver:75.0.3770.90
Selenium:3.141.0

I'm getting the error ```
OpenQA.Selenium.WebDriverException: 'invalid argument: entry 0 of 'firstMatch' is invalid
from invalid argument: perfLoggingPrefs specified, but performance logging was not enabled'

If the work around is to use LoggingPreference, can someone please tell me how to reference it since it does not seem to be in the 3.141.0 dll. Also, I think this might relate to the changes to 75.0.3770.8 Renamed capability loggingPrefs to goog:loggingPrefs, as required by W3C standard

public Driver(ChromeDriverModel chromeDriverModel)
        {
            ChromeOptions chromeOptions = new ChromeOptions();
            enablePerformanceMonitor = chromeDriverModel.enablePerformanceMonitoring;
            if (enablePerformanceMonitor)
                chromeOptions = _ChromePerformanceOptions();

            if (!string.IsNullOrWhiteSpace(chromeDriverModel.ChromeDriverLocation))
            {
                if (enablePerformanceMonitor)
                    _webDriver = new ChromeDriver(chromeDriverModel.ChromeDriverLocation, chromeOptions);
                else
                    _webDriver = new ChromeDriver(chromeDriverModel.ChromeDriverLocation);
            }
            else
            {
                if (enablePerformanceMonitor)
                    _webDriver = new ChromeDriver(chromeOptions);
                else
                    _webDriver = new ChromeDriver();
            }
        }


private ChromeOptions _ChromePerformanceOptions()
        {
            var option = new ChromeOptions();
            var perfLogPrefs = new ChromePerformanceLoggingPreferences();
            perfLogPrefs.AddTracingCategories(new string[] { "devtools.network", "devtools.timeline" });
            option.PerformanceLoggingPreferences = perfLogPrefs;
            option.AddAdditionalCapability(CapabilityType.EnableProfiling, true, true);
            option.SetLoggingPreference("performance", LogLevel.All);
            return option;
        }

Sorry if repost, not sure which is the official spot. 

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions