title: C# Selenium 4: Setup request interception
body: <p>I'm trying to use Selenium 4 to log requests during manual usage of Chrome browser.</p>
  <p>The issue is that request interception stops after around 40 seconds of usage (approximately).</p>
  <p>I've tried to change commandTimeout but it didn't change anything.
  Also I've tried to look into chromedriver logs but I didn't find anithing there.</p>
  <p>Here's my code:</p>
  <pre><code>static void Main(string[] args)
      {
          // Enable chromedriver logging
          var service = ChromeDriverService.CreateDefaultService();
          service.LogPath = AppDomain.CurrentDomain.BaseDirectory + &quot;chromedriver.log&quot;;
          service.EnableVerboseLogging = true;
          var options = new ChromeOptions();
  
          var webDriver = new ChromeDriver(service, options);
          var devToolsSession = webDriver.CreateDevToolsSession();
          devToolsSession.Network.Enable(new EnableCommandSettings());
  
          EventHandler&lt;RequestInterceptedEventArgs&gt; requestIntercepted = (sender, e) =&gt;
          {
              Console.WriteLine(e.Request.Url);
          };
  
          RequestPattern requestPattern = new RequestPattern();
          requestPattern.InterceptionStage = InterceptionStage.Request;
          requestPattern.ResourceType = ResourceType.Image;
          var setRequestInterceptionCommandSettings = new SetRequestInterceptionCommandSettings();
          setRequestInterceptionCommandSettings.Patterns = new RequestPattern[] { requestPattern };
          devToolsSession.Network.SetRequestInterception(setRequestInterceptionCommandSettings);
          devToolsSession.Network.RequestIntercepted += requestIntercepted;
  
          while (true)
          {
              webDriver.Url = &quot;https://translate.google.com/&quot;;
              Thread.Sleep(5000);
              webDriver.Navigate().Refresh();
          }
      }
  </code></pre>