Exemplo n.º 1
0
        /// <summary>
        /// Highlights DOM node with given id or with the given JavaScript object wrapper. Either nodeId or
        /// objectId must be specified.
        /// </summary>
        /// <param name = "highlightConfig">A descriptor for the highlight appearance.</param>
        /// <param name = "nodeId">Identifier of the node to highlight.</param>
        /// <param name = "backendNodeId">Identifier of the backend node to highlight.</param>
        /// <param name = "objectId">JavaScript object id of the node to be highlighted.</param>
        /// <param name = "selector">Selectors to highlight relevant nodes.</param>
        /// <returns>returns System.Threading.Tasks.Task&lt;DevToolsMethodResponse&gt;</returns>
        public async System.Threading.Tasks.Task <DevToolsMethodResponse> HighlightNodeAsync(CefSharp.DevTools.Overlay.HighlightConfig highlightConfig, int?nodeId = null, int?backendNodeId = null, string objectId = null, string selector = null)
        {
            ValidateHighlightNode(highlightConfig, nodeId, backendNodeId, objectId, selector);
            var dict = new System.Collections.Generic.Dictionary <string, object>();

            dict.Add("highlightConfig", highlightConfig.ToDictionary());
            if (nodeId.HasValue)
            {
                dict.Add("nodeId", nodeId.Value);
            }

            if (backendNodeId.HasValue)
            {
                dict.Add("backendNodeId", backendNodeId.Value);
            }

            if (!(string.IsNullOrEmpty(objectId)))
            {
                dict.Add("objectId", objectId);
            }

            if (!(string.IsNullOrEmpty(selector)))
            {
                dict.Add("selector", selector);
            }

            var methodResult = await _client.ExecuteDevToolsMethodAsync("Overlay.highlightNode", dict);

            return(methodResult);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Enters the 'inspect' mode. In this mode, elements that user is hovering over are highlighted.
        /// Backend then generates 'inspectNodeRequested' event upon element selection.
        /// </summary>
        /// <param name = "mode">Set an inspection mode.</param>
        /// <param name = "highlightConfig">A descriptor for the highlight appearance of hovered-over nodes. May be omitted if `enabled
        public async System.Threading.Tasks.Task <DevToolsMethodResponse> SetInspectModeAsync(CefSharp.DevTools.Overlay.InspectMode mode, CefSharp.DevTools.Overlay.HighlightConfig highlightConfig = null)
        {
            ValidateSetInspectMode(mode, highlightConfig);
            var dict = new System.Collections.Generic.Dictionary <string, object>();

            dict.Add("mode", this.EnumToString(mode));
            if ((highlightConfig) != (null))
            {
                dict.Add("highlightConfig", highlightConfig.ToDictionary());
            }

            var methodResult = await _client.ExecuteDevToolsMethodAsync("Overlay.setInspectMode", dict);

            return(methodResult);
        }