Basically i am trying to automate if a player receives data from OBS. Besides manual, the best way i can think of how to automate would be able to read and confirm that the player is receiving data from OBS.

Is it possible? Is selenium able to read the inspect -> console on the browser? I am only working with google chrome, so no need of a work around on firefox.

What i've tried so far is:

    using FirstTestCase.PageObjectMethods;
using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using System;
using System.Threading;

namespace FirstTestCase

    class TestClassLog

        class NUnitTest
            private IWebDriver _driver;

            [TestCase(TestName = "test")]
            public void Initialize()
                ChromeOptions options = new ChromeOptions();
                options.SetLoggingPreference(LogType.Browser, LogLevel.All);

                var driver = new ChromeDriver(options);
                driver.Url = "test.test";
                var homePage = new HomePage(driver);

                var logs = driver.Manage().Logs.GetLog(LogType.Browser);
                foreach (var log in logs)

Url is hidden due to privacy policies with my employer.

With this log in script i get an exception on the line:

var logs = driver.Manage().Logs.GetLog(LogType.Browser); `System.NullReferenceException: 'Object reference not set to an instance of an object.'`

Which I am not able to get by.

  • Try to break the line Manage().Logs.GetLog to one call by line. You may see which call returns null. Jul 14 at 13:08
  • @JoãoFarias that was a good idea. I split that line in 3 lines the exception happens on GetLog(LogType.Browser).
    – DjNewma
    Jul 14 at 14:05
  • It means you don't have any logs. Jul 15 at 10:14
  • @JoãoFarias to confirm, this code get's the console logs in the inspect right? As in when you inspect and see the console entries
    – DjNewma
    Jul 15 at 10:24
  • A browser Inspect tab may have a different implementation and show logs differently. What you gonna get it's Selenium logs, which probably will be the same, but may be different. Jul 15 at 10:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.