0

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.

Leon
  • 165
  • 12
  • A request/response is HTML format. You do not need to intercept the Response. All you need to do is sent the HTML response to a parser. You do not need the browser. A Request has the UserAgent header which determines the type of browser and you may need to set the UserAgent. – jdweng Oct 04 '22 at 18:02
  • This is not what I am looking for... I MUST use particular/existing web app. After I embed the browser in the WinForm I need to hook up to that URL through CDP Session over WebSocket and receive the data that is sent from the server... – Leon Oct 04 '22 at 20:28
  • You can use a relay. A relay is a two port application One port will be a server that your win form browser connect to. The second of relay is a client that connect to the server. The relays will send everything from browser to server. In reverse direction it will intercept the response from the server before forwarding to the browser. – jdweng Oct 04 '22 at 22:16

1 Answers1

0

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.

Leon
  • 165
  • 12