Accessing Chrome DevTools Network Logs w/ 4.1.0 & Chome 97

234 views
Skip to first unread message

Jamie Brandwood

unread,
Jan 26, 2022, 11:26:40 PM1/26/22
to Selenium Users
Hi Selenium Community,

I'm fairly new to the Selenium world. But especially new to enabling the DevTools to extract a private API call from the netork logs.

Currently using Selenium WebDriver 4.1.0 w/ Chrome Driver 97. Everything seems to work as expected for my general browsing etc. But when i want to enable Netork Performance logging i get "perfLoggingPrefs specified, but performance logging was not enabled"

Snippet below if it helps (apologies its in PowerShell but any C# answers would be good):

    $ChromiumPerformanceLoggingPreferences = New-Object -TypeName OpenQA.Selenium.Chromium.ChromiumPerformanceLoggingPreferences
    $ChromiumPerformanceLoggingPreferences.IsCollectingNetworkEvents = $True
    $ChromiumPerformanceLoggingPreferences.IsCollectingPageEvents = $False

    $ChromeOptions = New-Object -TypeName OpenQA.Selenium.Chrome.ChromeOptions
    $ChromeOptions.AddUserProfilePreference('download.default_directory', $DefaultDownloadDirectory)
    $ChromeOptions.PerformanceLoggingPreferences = $ChromiumPerformanceLoggingPreferences
    $ChromeOptions.SetLoggingPreference([OpenQA.Selenium.LogType]::Browser, [OpenQA.Selenium.LogLevel]::All)
   
    $ChromeDriver = New-Object -TypeName OpenQA.Selenium.Chrome.ChromeDriver($ChromeDriverPath, $ChromeOptions)

Any advice would be much appreciated.

SiKing

unread,
Jan 27, 2022, 12:41:59 PM1/27/22
to Selenium Users
"Performance logging is NOT enabled by default."

"... I'm using .NET to build this and LogType.PERFORMANCE is not an option for me."

Good luck.
Reply all
Reply to author
Forward
0 new messages