Embedding PuppeteerSharp browser in WinForms and intercepting WebSocket responses

386 Views Asked by At

I have WinForms app under development and I have to embed a browser in one of the windows and intercept the responses with the WebSocket. Questions:

  1. PuppeterSharp is .NET Standard 2.0 library, but my project is based on .NET 4.8. So, is it possible at all to use it?
  2. I am targeting Win10 and Win11 that has Edge browser. Will it impact this in any way?
  3. Is there PuppeterSharp control that I simply drag to the window in VS2022?
  4. Is there any example of CDP Session in C# that shows how to intercept response on WebSocket?

The reason I am not considering WebView2 is because it is in preview and not recommended by MS for production code.

1

There are 1 best solutions below

0
Leon On

My solution was using a different chromium browser CefSharp and then reaching to the supported CDP Session and hooking to the WebSocket frame receiving event.