-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhancement - Add DevToolsClient (Direct Devtools Protocol) #3165
Comments
* Core - Add DevToolsClient Issue #3165 * DevTools Client - Add Network domain class - Add hand written class to get a better sense of how the code should be structured. - Improve exception handling * Devtools - First draft of devtools protocol methods (generated) Not complete yet * Devtools - Simple method execution working * DevTools - Add .Net Style cased property names to response objects - Use internal field and datacontract attributes * DevTools - Improve mapping * DevTools - Strongly typed enums * DevTools Client - Generated from active browser instance (M84) * Devtools Client - Extract IDevToolsClient interface for testability Improve xml doc comments * DevTools Client - Improve error handling * DevTools Client - Improve enum conversion * Revert to older c# syntax * DevTools Client - Fix failing tests * Devtools Client - Add SetCookie Tests * DevTools Client - Add Capture SyncContext by default - Add option to capture the SyncContext - Add option to provide custom SyncContext (can just pass in UI SyncContext and all continuations will happen there). - Fix bug in ExecuteDevToolsMethodAsync sending the command twice when exeucted on the CEF UI thread * Devtools Client - Add missing file reference The problem with developing with the .Net Core project where files are automatically included is you forget to include them in the regular csproj file. * Devtools Client - Add CanCanEmulate Test case * DevTools Client - Add AddScriptToEvaluateOnNewDocumentAsync test * DevTools Client - OnDevToolsEvent only parse data if event handler != null * DevTools Client - GetDevToolsClient remove ThrowExceptionIfDisposed/ThrowExceptionIfBrowserNotInitialized calls Those methods were removed as the GetBrowser call handles the checks for us. * DevTools Client - Improve error handling * DevTools Client - Update xml doc comments * DevTools Client - Add validation method (partial) Add ability to manually add validation logic * DevTools Client - Comment out failing test Was working when targeting M84, now with M85 it fails. The mapping appears to be correct, will need to investigate further * OffScreen Example - Remove test code
TO BE REMOVED:
|
Developing features like this takes considerably time and effort, if you use |
Example of changing User Agent at runtime at https://stackoverflow.com/a/64543667/4583726 |
With GetDevToolsClient is possible capture traffic in network tab ? |
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. |
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. |
See https://gist.github.com/amaitland/eabb42a191c4943610f2407196b0e03a for an example of changing tge user agent at runtime using the DevTools protocol. |
Follow up to #3158
A nicer
API
build on top of theCEF API
to make it easier to send/receive messages fromDevTools
.The
API
is generated on top of theDevTools
protocol to create a set of model classes to simplify executingDevTools
commands.The
CefSharp.DevTools.DevToolsClient
class is the primary method of accessing the different domains. EachDevTools Domain
has it's own namespace that containsenums
and strongly typed return classes.Network
Domain
is part of theCefSharp.DevTools.Network
namespace. The methods are accessibly though theDevToolsClient
class.Some basic examples look like (extract from the unit tests)
The text was updated successfully, but these errors were encountered: