You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A nicer API build on top of the CEF API to make it easier to send/receive messages from DevTools.
The API is generated on top of the DevTools protocol to create a set of model classes to simplify executing DevTools commands.
Add Strongly typed DevTools Domain classes
Deprecated methods are not generated
Only methods (no strongly typed events yet, a new issue should be created for that.)
The CefSharp.DevTools.DevToolsClient class is the primary method of accessing the different domains. Each DevTools Domain has it's own namespace that contains enums and strongly typed return classes.
NetworkDomain is part of the CefSharp.DevTools.Network namespace. The methods are accessibly though the DevToolsClient class.
Some basic examples look like (extract from the unit tests)
CEF doesn't support every aspect of DevTools, the generated API is based of the protocol definition which can be downloaded from the browser at runtime and is used for code generation. If you find a method that CEF doesn't support please post here and I will at some point update the generator to remove those methods.
TO BE REMOVED:
Page.printToPdf is only accessibly when using Headless Chromium and not supported.
Activity
[-]Enhancement - Add DevToolsManager (Direct Devtools Protocol)[/-][+]Enhancement - Add DevToolsClient (Direct Devtools Protocol)[/+]Core - Add DevToolsClient
Core - Add DevToolsClient
Enhancement - Add DevToolsClient (#3229)
amaitland commentedon Oct 6, 2020
CEFdoesn't support every aspect ofDevTools, the generatedAPIis based of the protocol definition which can be downloaded from the browser at runtime and is used for code generation. If you find a method thatCEFdoesn't support please post here and I will at some point update the generator to remove those methods.TO BE REMOVED:
Headless Chromiumand not supported.amaitland commentedon Oct 6, 2020
Developing features like this takes considerably time and effort, if you use
CefSharpin a commercial application then please consider sponsoring me https://github.com/cefsharp/CefSharp#financial-supportamaitland commentedon Oct 26, 2020
Example of changing User Agent at runtime at https://stackoverflow.com/a/64543667/4583726
totti240282 commentedon Oct 29, 2020
With GetDevToolsClient is possible capture traffic in network tab ?
amaitland commentedon Oct 29, 2020
Yes. You can subscribe to http://cefsharp.github.io/api/85.3.x/html/F_CefSharp_DevTools_DevToolsClient_DevToolsEvent.htm
As per #3158 (comment) you must call enable/disable for the specific domain.
amaitland commentedon Nov 17, 2020
For .Net core it might be worth generating some nicer code in relation to the JSON parsing involved here. Using https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=net-5.0 should be feasible.
amaitland commentedon Jan 5, 2021
See https://gist.github.com/amaitland/eabb42a191c4943610f2407196b0e03a for an example of changing tge user agent at runtime using the DevTools protocol.