BernardV
BernardV

Reputation: 766

Selenium Chrome Driver (75 onward) problem accessing Logs using GetLog() method

In version 74.0.3729.6 of the Selenium.WebDriver.ChromeDriver I am able to run the following code without problem:

foreach (var logItem in driverInstance.Manage().Logs.GetLog(LogType.Browser).ToList())
{
    NLogLogger.Debug(logItem.Message);
}

But from version 75.0.3770.90

System.NullReferenceException: 'Object reference not set to an instance of an object.'

Within the latest release notes I found some mention of logging changing but no clear indication of what has changed or might be causing this problem:

  • Resolved issue 2947: No W3C compliant endpoints for retrieving logs [Pri-2]
  • Resolved issue 2803: Capability name loggingPrefs is not spec compliant [Pri-2]

https://chromedriver.storage.googleapis.com/75.0.3770.90/notes.txt

Ideally I would not like to remove this code as my ability to acquire logs from the browser side is a requirement but I would also not like to be locked down to version 74 of the Selenium Chrome Driver as this will obviously over time become a bigger and bigger problem, so I am wondering whether someone could suggest a different way of accessing these logs dynamically?

Upvotes: 3

Views: 1751

Answers (2)

Artem Krosheninnikov
Artem Krosheninnikov

Reputation: 156

Not sure about C# bindings but for Java changing loggingPrefs to goog:loggingPrefs helped me, I've found an answer here: https://stackoverflow.com/a/56536604/10824437

Upvotes: 0

Fieldfare
Fieldfare

Reputation: 167

driver.Manage().Logs.GetLog(LogType.Browser) no longer working in Chromedriver version 75.0.3770

I ran into the same issue, unfortunately it is not going to work in w3c mode for the current version of Selenium.

Upvotes: 2

Related Questions