mobileFX WebKitX CEF3 ActiveX 4.x
WebKitXCEF3Lib ActiveX Control / WebKitXCEF3 Object / ExecDevToolsCommand Method

The method name to execute.

A JSON string of method parameters.

A Boolean indicating if the execution of the command is blocking or not.

In This Topic
    ExecDevToolsCommand Method
    In This Topic
    Description

    Execute a DevTools Command.

    Syntax
    Visual Basic
    Public Function ExecDevToolsCommand( _
       ByVal Method As String, _
       Optional ByVal Params As String = "", _
       Optional ByVal Blocking As Boolean = False _
    ) As String
    Parameters
    Method

    The method name to execute.

    Params

    A JSON string of method parameters.

    Blocking

    A Boolean indicating if the execution of the command is blocking or not.

    Return Type

    A JSON string containing the result of the DevTools method invoked.

    Remarks

    The Chrome DevTools Protocol allows for tools to instrument, inspect, debug and profile Chromium, Chrome and other Blink-based browsers. 

    Instrumentation is divided into a number of domains (DOM, Debugger, Network etc.).

    Each domain defines a number of commands it supports and events it generates.

    Both commands and events are serialized JSON objects of a fixed structure.

     

    More info can be found here:

    https://chromedevtools.github.io/devtools-protocol/

    Example
    Private Sub GetNodeStyles()
    
        Dim NodeID As String
        Dim JSON As String
        
        NodeID = WebKitX.GetNodeID("#mydiv")
        JSON = WebKitX.ExecDevToolsCommand("CSS.getMatchedStylesForNode", """nodeId"": " + NodeID, True)
    
    End Sub
    
    Private Sub WebKitX_OnDevToolsWebSocket(ByVal Data As String)
        
        On Error Resume Next
        If InStr(Data, "CSS.styleSheetAdded") > 0 Then
            Dim xDOM As Object
            Set xDOM = XML_DOM(JSONtoXML(Data))
            StyleSheets.Add xDOM.selectSingleNode("//styleSheetId").Text, xDOM.selectSingleNode("//sourceURL").Text
        End If
        Err.Clear
    
    End Sub
    
    Public Function XML_DOM(Optional sAnyXML) As IXMLDOMDocument
        Dim xDOM As DOMDocument30
        Set xDOM = New DOMDocument30
        xDOM.Async = False
        xDOM.resolveExternals = False
        xDOM.validateOnParse = False
        If Not IsMissing(sAnyXML) Then
            If IsObject(sAnyXML) Then
                xDOM.Load sAnyXML
            ElseIf sAnyXML <> vbNullString Then
                If InStrB(sAnyXML, "<") Then
                    xDOM.loadXML sAnyXML
                Else
                    xDOM.Load sAnyXML
                End If
            End If
        End If
        xDOM.SetProperty "SelectionLanguage", "XPath"
        xDOM.SetProperty "SelectionNamespaces", vbNullString
        Set XML_DOM = xDOM
    End Function
    See Also