mobileFX WebKitX CEF3 ActiveX 4.x
WebKitXCEF3Lib ActiveX Control / WebKitXCEF3 Object / OnDevToolsWebSocket Event

JSON output data of the Inspector Protocol Event or Command.

In This Topic
    OnDevToolsWebSocket Event
    In This Topic
    Description

    Fired when a Chromium Inspector Protocol Event is generated or as a result of an Inspector Protocol command.

    Syntax
    Visual Basic
    Public Event OnDevToolsWebSocket( _
       ByVal Data As String _
    )
    Parameters
    Data

    JSON output data of the Inspector Protocol Event or Command.

    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