driver.Manage().Logs.GetLog(LogType.Browser) no lo

2020-08-26 03:39发布

问题:

I am working on a Selenium framework using C# .net and Selenium Webdriver (with Chromedriver). I recently updated to the latest version of Chromedriver 75.0.3770.8 and now one of my lines of code is no longer working:

driver.Manage().Logs.GetLog(LogType.Browser)

My ChromeOptions are set as follows:

options.SetLoggingPreference(LogType.Browser, LogLevel.Severe);

None of this has changed - the only update I've made is to Chromedriver 75. If I revert back to Chromedriver 74 then this code works again. Currently it is failing with "object reference not set to an instance of an object". The release notes for this version of Chromedriver mentioned "Resolved issue 2536: Make standards mode (goog:chromeOptions.w3c:true) the default [Pri-2]" and "Resolved issue 2803: Capability name loggingPrefs is not spec compliant [Pri-2]"

Other than that I can't see anything that could possibly be causing this to fail. Is this something that is no longer supported? Or is there something I need to replace my code with? Thanks

回答1:

From SeleniumHQ:

"Getting logs from Chrome in w3c mode is not going to work till the next selenium client libs (and server) release"



回答2:

i'am using

KeywordLogger log = new KeywordLogger(); log.logInfo("");



回答3:

We are waiting for this fix since September 2019, how long does it going to take - no one knows. I have installed Selenium.Webdriver v.3.7.0 (available in NuGet) and enjoying this functionality.