IBrowserHostSendDevToolsMessage Method |
Version 101.0.180
Send a method call message over the DevTools protocol.
message must be a
UTF8-encoded JSON dictionary that contains "id" (int), "method" (string)
and "params" (dictionary, optional) values. See the DevTools protocol
documentation at https://chromedevtools.github.io/devtools-protocol/ for
details of supported methods and the expected "params" dictionary contents.
message will be copied if necessary. This method will return true if
called on the CEF UI thread and the message was successfully submitted for
validation, otherwise false. Validation will be applied asynchronously and
any messages that fail due to formatting errors or missing parameters may
be discarded without notification. Prefer ExecuteDevToolsMethod if a more
structured approach to message formatting is desired.
Every valid method call will result in an asynchronous method result or
error message that references the sent message "id". Event messages are
received while notifications are enabled (for example, between method calls
for "Page.enable" and "Page.disable"). All received messages will be
delivered to the observer(s) registered with AddDevToolsMessageObserver.
See
OnDevToolsMessage(IBrowser, Stream) documentation for details
of received message contents.
Usage of the SendDevToolsMessage, ExecuteDevToolsMethod and
AddDevToolsMessageObserver methods does not require an active DevTools
front-end or remote-debugging session. Other active DevTools sessions will
continue to function independently. However, any modification of global
browser state by one session may not be reflected in the UI of other
sessions.
Communication with the DevTools front-end (when displayed) can be logged
for development purposes by passing the
`--devtools-protocol-log-file=<path>` command-line flag.
Namespace:
CefSharp
Assembly:
CefSharp (in CefSharp.dll) Version: 101.0.180.0 (101.0.180.0)
Syntax bool SendDevToolsMessage(
string messageAsJson
)
bool SendDevToolsMessage(
String^ messageAsJson
)
Parameters
- messageAsJson
- Type: SystemString
must be a UTF8-encoded JSON dictionary that contains "id" (int), "method" (string)
and "params" (dictionary, optional) values. See comments above for further details.
Return Value
Type:
Booleanreturns true if called on the CEF UI thread and the message was successfully submitted for
validation, otherwise false.
See Also