Closed
Description
Follow up to #3158
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.
Network Domain
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)
using (var browser = new ChromiumWebBrowser("www.google.com"))
{
await browser.WaitForInitialLoadAsync();
using (var devToolsClient = browser.GetDevToolsClient())
{
var response = await devToolsClient.Network.SetCookieAsync(name, value, domain: domain, sameSite: sameSite);
}
}
using (var browser = new ChromiumWebBrowser("www.google.com"))
{
await browser.WaitForInitialLoadAsync();
using (var devToolsClient = browser.GetDevToolsClient())
{
var response = await devToolsClient.Browser.GetVersionAsync();
var jsVersion = response.JsVersion;
var revision = response.Revision;
}
}