-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Closed
Labels
A-needs-triagingA Selenium member will evaluate this soon!A Selenium member will evaluate this soon!I-defectSomething is not working as intendedSomething is not working as intended
Description
What happened?
var options = new ChromeOptions();
options.SetLoggingPreference(LogType.Browser, LogLevel.All);
var Driver = new ChromeDriver(options);
Driver.Url = "https://www.selenium.dev/selenium/web/bidi/logEntryAdded.html";
Driver.FindElement(By.Id("consoleLog")).Click();
Driver.FindElement(By.Id("consoleError")).Click();
Console logs returned as zero using .NET Selenium even though there are errors
Issue:
When trying to capture browser console logs using the following code in .NET Selenium:
csharp
Copy code
var jsErrors = Driver.Manage().Logs.GetLog(LogType.Browser);
the returned log shows zero entries, even though errors are clearly present in the browser's console.
How can we reproduce the issue?
var options = new ChromeOptions();
options.SetLoggingPreference(LogType.Browser, LogLevel.All);
var Driver = new ChromeDriver(options);
Driver.Url = "https://www.selenium.dev/selenium/web/bidi/logEntryAdded.html";
Driver.FindElement(By.Id("consoleLog")).Click();
Driver.FindElement(By.Id("consoleError")).Click();
How to capture console logs using selenium and c#Relevant log output
The following code:
csharp
jsErrors = Driver.Manage().Logs.GetLog(LogType.Browser);
returns no errors, even though there are errors present in the browser console.Operating System
Windows 10
Selenium version
Selenium Version 4.25.0
What are the browser(s) and version(s) where you see this issue?
Chrome
What are the browser driver(s) and version(s) where you see this issue?
129.0.6668.7
Are you using Selenium Grid?
No
Metadata
Metadata
Assignees
Labels
A-needs-triagingA Selenium member will evaluate this soon!A Selenium member will evaluate this soon!I-defectSomething is not working as intendedSomething is not working as intended