Ejemplo n.º 1
0
 /// <summary>
 /// Sets JavaScript breakpoint at given location specified either by URL or URL regex.
 /// Once this command is issued, all existing parsed scripts will have breakpoints resolved and
 /// returned in locations property. Further matching script parsing will result in subsequent
 /// breakpointResolved events issued. This logical breakpoint will survive page reloads.
 /// </summary>
 /// <param name="lineNumber">Line number to set breakpoint at.</param>
 /// <param name="url">URL of the resources to set breakpoint on.</param>
 /// <param name="urlRegex">Regex pattern for the URLs of the resources to set breakpoints on.
 /// Either url or urlRegex must be specified.</param>
 /// <param name="columnNumber">Offset in the line to set breakpoint at.</param>
 /// <param name="condition">Expression to use as a breakpoint condition.
 /// When specified, debugger will only stop on the breakpoint if this expression evaluates to true.</param>
 /// <returns>breakpointId (string): Id of the created breakpoint for further reference.
 /// locations (optional array of Location): List of the locations this breakpoint resolved into upon addition.</returns>
 /// <see cref="https://developers.google.com/chrome-developer-tools/docs/protocol/1.0/debugger#command-setBreakpointByUrl"/>
 public static Command SetBreakpointByUrl(
     int lineNumber,
     string url       = null,
     string urlRegex  = null,
     int?columnNumber = null,
     string condition = null)
 {
     if (url == null && urlRegex == null)
     {
         throw new ArgumentException("Either url or urlRegex must be specified.");
     }
     else
     {
         var com = new Command("Debugger.setBreakpointByUrl");
         com.addParam("lineNumber", lineNumber);
         if (url != null)
         {
             com.addParam("url", url);
         }
         if (urlRegex != null)
         {
             com.addParam("urlRegex", urlRegex);
         }
         if (columnNumber != null)
         {
             com.addParam("columnNumber", columnNumber);
         }
         if (condition != null)
         {
             com.addParam("condition", condition);
         }
         return(com);
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Edits JavaScript source live.
        /// </summary>
        /// <param name="scriptId">Id of the script to edit.</param>
        /// <param name="scriptSource">New content of the script.</param>
        /// <returns>callFrames (optional array of CallFrame): New stack trace in case editing has happened while VM was stopped.</returns>
        /// <see cref="https://developers.google.com/chrome-developer-tools/docs/protocol/1.0/debugger#command-setScriptSource"/>
        public static Command SetScriptSource(string scriptId, string scriptSource)
        {
            var com = new Command("Debugger.setScriptSource");

            com.addParam("scriptId", scriptId);
            com.addParam("scriptSource", scriptSource);
            return(com);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Evaluates expression on global object.
 /// </summary>
 /// <param name="expression">Expression to evaluate.</param>
 /// <param name="objectGroup">(optional) Symbolic group name that can be used to release multiple objects.</param>
 /// <param name="returnByValue">(optional) Whether the result is expected to be a JSON object that should be sent by value.</param>
 /// <returns>result (RemoteObject): Evaluation result.
 /// wasThrown (optional boolean): True if the result was thrown during the evaluation.
 public static Command Evaluate(string expression, string objectGroup = null, bool returnByValue = false)
 {
     var com = new Command("Runtime.evaluate");
     com.addParam("expression", expression);
     com.addParam("objectGroup", objectGroup);
     if (returnByValue)
         com.addParam("returnByValue", returnByValue);
     return com;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Returns properties of a given object. Object group of the result is inherited from the target object.
 /// </summary>
 /// <param name="objectId">Identifier of the object to return properties for.</param>
 /// <param name="ownProperties">If true, returns properties belonging only to the element itself, 
 /// not to its prototype chain.</param>
 /// <returns>result (array of PropertyDescriptor): Object properties.</returns>
 public static Command GetProperties(string objectId, bool ownProperties = false)
 {
     var com = new Command("Runtime.getProperties");
     com.addParam("objectId", objectId);
     if (ownProperties)
     {
         com.addParam("ownProperties", ownProperties);
     }
     return com;
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Returns properties of a given object. Object group of the result is inherited from the target object.
        /// </summary>
        /// <param name="objectId">Identifier of the object to return properties for.</param>
        /// <param name="ownProperties">If true, returns properties belonging only to the element itself,
        /// not to its prototype chain.</param>
        /// <returns>result (array of PropertyDescriptor): Object properties.</returns>
        public static Command GetProperties(string objectId, bool ownProperties = false)
        {
            var com = new Command("Runtime.getProperties");

            com.addParam("objectId", objectId);
            if (ownProperties)
            {
                com.addParam("ownProperties", ownProperties);
            }
            return(com);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Sets JavaScript breakpoint at a given location.
        /// </summary>
        /// <param name="location">Location to set breakpoint in.</param>
        /// <param name="condition">Expression to use as a breakpoint condition. When specified,
        /// debugger will only stop on the breakpoint if this expression evaluates to true.</param>
        /// <returns>breakpointId (string): Id of the created breakpoint for further reference.
        /// actualLocation (Location): Location this breakpoint resolved into.</returns>
        /// <see cref="https://developers.google.com/chrome-developer-tools/docs/protocol/1.0/debugger#command-setBreakpoint"/>
        public static Command SetBreakpoint(Location location, string condition = null)
        {
            var com = new Command("Debugger.setBreakpoint");

            com.addParam("location", location);
            if (condition != null)
            {
                com.addParam("condition", condition);
            }
            return(com);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Evaluates expression on global object.
        /// </summary>
        /// <param name="expression">Expression to evaluate.</param>
        /// <param name="objectGroup">(optional) Symbolic group name that can be used to release multiple objects.</param>
        /// <param name="returnByValue">(optional) Whether the result is expected to be a JSON object that should be sent by value.</param>
        /// <returns>result (RemoteObject): Evaluation result.
        /// wasThrown (optional boolean): True if the result was thrown during the evaluation.
        public static Command Evaluate(string expression, string objectGroup = null, bool returnByValue = false)
        {
            var com = new Command("Runtime.evaluate");

            com.addParam("expression", expression);
            com.addParam("objectGroup", objectGroup);
            if (returnByValue)
            {
                com.addParam("returnByValue", returnByValue);
            }
            return(com);
        }
Ejemplo n.º 8
0
 /// <summary>
 /// Reloads given page optionally ignoring the cache.
 /// </summary>
 /// <param name="ignoreCache">If true, browser cache is ignored (as if the user pressed Shift+refresh).</param>
 /// <param name="scriptToEvaluateOnLoad">If set, the script will be injected into all frames of the inspected page after reload.</param>
 /// <see cref="https://developers.google.com/chrome-developer-tools/docs/protocol/1.0/page#command-reload"/>
 /// <returns></returns>
 public static Command Reload(bool ignoreCache = false, string scriptToEvaluateOnLoad = null)
 {
     var com = new Command("Page.reload");
     if (!ignoreCache)
     {
         com.addParam("ignoreCache", ignoreCache);
     }
     if (scriptToEvaluateOnLoad == null)
     {
         com.addParam("scriptToEvaluateOnLoad", scriptToEvaluateOnLoad);
     }
     return com;
 }
Ejemplo n.º 9
0
        /// <summary>
        /// Reloads given page optionally ignoring the cache.
        /// </summary>
        /// <param name="ignoreCache">If true, browser cache is ignored (as if the user pressed Shift+refresh).</param>
        /// <param name="scriptToEvaluateOnLoad">If set, the script will be injected into all frames of the inspected page after reload.</param>
        /// <see cref="https://developers.google.com/chrome-developer-tools/docs/protocol/1.0/page#command-reload"/>
        /// <returns></returns>
        public static Command Reload(bool ignoreCache = false, string scriptToEvaluateOnLoad = null)
        {
            var com = new Command("Page.reload");

            if (!ignoreCache)
            {
                com.addParam("ignoreCache", ignoreCache);
            }
            if (scriptToEvaluateOnLoad == null)
            {
                com.addParam("scriptToEvaluateOnLoad", scriptToEvaluateOnLoad);
            }
            return(com);
        }
Ejemplo n.º 10
0
 /// <summary>
 /// Calls function with given declaration on the given object. Object group of the result is inherited from the target object.
 /// </summary>
 /// <param name="objectId">Identifier of the object to call function on.</param>
 /// <param name="functionDeclaration">Declaration of the function to call.</param>
 /// <param name="arguments">(optional) Call arguments. All call arguments must belong to the same JavaScript world as the target object.</param>
 /// <param name="returnByValue">(optional) Whether the result is expected to be a JSON object which should be sent by value.</param>
 /// <returns>result (RemoteObject): Call result.
 /// wasThrown (optional boolean): True if the result was thrown during the evaluation.</returns>
 public static Command CallFunctionOn(string objectId, string functionDeclaration, CallArgument[] arguments = null, bool returnByValue = false)
 {
     var com = new Command("Runtime.callFunctionOn");
     com.addParam("objectId", objectId);
     com.addParam("functionDeclaration", functionDeclaration);
     if (arguments != null)
     {
         com.addParam("arguments", arguments);
     }
     if (returnByValue)
     {
         com.addParam("returnByValue", returnByValue);
     }
     return com;
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Evaluates expression on a given call frame.
 /// </summary>
 /// <param name="callFrameId">Call frame identifier to evaluate on.</param>
 /// <param name="expression">Expression to evaluate.</param>
 /// <param name="objectGroup">(Optional) String object group name to put result into (allows rapid releasing resulting object handles using releaseObjectGroup).</param>
 /// <param name="returnByValue">(Optional) Whether the result is expected to be a JSON object that should be sent by value.</param>
 /// <returns>result (Runtime.RemoteObject): Object wrapper for the evaluation result.
 /// wasThrown (optional boolean): True if the result was thrown during the evaluation.</returns>
 /// <see cref="https://developers.google.com/chrome-developer-tools/docs/protocol/1.0/debugger#command-evaluateOnCallFrame"/>
 public static Command EvaluateOnCallFrame(string callFrameId, string expression, string objectGroup = null, bool returnByValue = false)
 {
     var com = new Command("Debugger.evaluateOnCallFrame");
     com.addParam("callFrameId", callFrameId);
     com.addParam("expression", expression);
     if (objectGroup != null)
     {
         com.addParam("objectGroup", objectGroup);
     }
     if (returnByValue)
     {
         com.addParam("returnByValue", returnByValue);
     }
     return com;
 }
Ejemplo n.º 12
0
        /// <summary>
        /// Releases all remote objects that belong to a given group.
        /// </summary>
        /// <param name="objectGroup">Symbolic object group name.</param>
        /// <returns></returns>
        public static Command ReleaseObjectGroup(string objectGroup)
        {
            var com = new Command("Runtime.releaseObjectGroup");

            com.addParam("objectGroup", objectGroup);
            return(com);
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Releases remote object with given id.
        /// </summary>
        /// <param name="objectId">Identifier of the object to release.</param>
        /// <returns></returns>
        public static Command ReleaseObject(string objectId)
        {
            var com = new Command("Runtime.releaseObject");

            com.addParam("objectId", objectId);
            return(com);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Allows overriding user agent with the given string.
        /// </summary>
        /// <param name="userAgent"></param>
        /// <returns>userAgent (string): Useragent to use.</returns>
        public static Command SetUserAgentOverride(string userAgent)
        {
            var com = new Command("Network.setUserAgentOverride");

            com.addParam("userAgent", userAgent);
            return(com);
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Returns content served for the given request.
        /// </summary>
        /// <param name="requestId">Identifier of the network request to get content for.</param>
        /// <returns>body (string): Response body.
        /// base64Encoded (boolean): True, if content was sent as base64.</returns>
        public static Command GetResponseBody(string requestId)
        {
            var com = new Command("Network.getResponseBody");

            com.addParam("requestId", requestId);
            return(com);
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Calls function with given declaration on the given object. Object group of the result is inherited from the target object.
        /// </summary>
        /// <param name="objectId">Identifier of the object to call function on.</param>
        /// <param name="functionDeclaration">Declaration of the function to call.</param>
        /// <param name="arguments">(optional) Call arguments. All call arguments must belong to the same JavaScript world as the target object.</param>
        /// <param name="returnByValue">(optional) Whether the result is expected to be a JSON object which should be sent by value.</param>
        /// <returns>result (RemoteObject): Call result.
        /// wasThrown (optional boolean): True if the result was thrown during the evaluation.</returns>
        public static Command CallFunctionOn(string objectId, string functionDeclaration, CallArgument[] arguments = null, bool returnByValue = false)
        {
            var com = new Command("Runtime.callFunctionOn");

            com.addParam("objectId", objectId);
            com.addParam("functionDeclaration", functionDeclaration);
            if (arguments != null)
            {
                com.addParam("arguments", arguments);
            }
            if (returnByValue)
            {
                com.addParam("returnByValue", returnByValue);
            }
            return(com);
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Toggles ignoring cache for each request. If true, cache will not be used.
        /// </summary>
        /// <param name="cacheDisabled">Cache disabled state.</param>
        /// <returns></returns>
        public static Command SetCacheDisabled(bool cacheDisabled)
        {
            var com = new Command("Network.setCacheDisabled");

            com.addParam("cacheDisabled", cacheDisabled);
            return(com);
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Evaluates expression on a given call frame.
        /// </summary>
        /// <param name="callFrameId">Call frame identifier to evaluate on.</param>
        /// <param name="expression">Expression to evaluate.</param>
        /// <param name="objectGroup">(Optional) String object group name to put result into (allows rapid releasing resulting object handles using releaseObjectGroup).</param>
        /// <param name="returnByValue">(Optional) Whether the result is expected to be a JSON object that should be sent by value.</param>
        /// <returns>result (Runtime.RemoteObject): Object wrapper for the evaluation result.
        /// wasThrown (optional boolean): True if the result was thrown during the evaluation.</returns>
        /// <see cref="https://developers.google.com/chrome-developer-tools/docs/protocol/1.0/debugger#command-evaluateOnCallFrame"/>
        public static Command EvaluateOnCallFrame(string callFrameId, string expression, string objectGroup = null, bool returnByValue = false)
        {
            var com = new Command("Debugger.evaluateOnCallFrame");

            com.addParam("callFrameId", callFrameId);
            com.addParam("expression", expression);
            if (objectGroup != null)
            {
                com.addParam("objectGroup", objectGroup);
            }
            if (returnByValue)
            {
                com.addParam("returnByValue", returnByValue);
            }
            return(com);
        }
Ejemplo n.º 19
0
        /// <summary>
        /// Navigates current page to the given URL.
        /// </summary>
        /// <param name="url">URL to navigate the page to.</param>
        /// <see cref="https://developers.google.com/chrome-developer-tools/docs/protocol/1.0/page#command-navigate"/>
        /// <returns></returns>
        public static Command Navigate(string url)
        {
            var com = new Command("Page.navigate");

            com.addParam("url", url);
            return(com);
        }
Ejemplo n.º 20
0
        /// <summary>
        /// Searches for given string in script content.
        /// </summary>
        /// <param name="scriptId">Id of the script to search in.</param>
        /// <param name="query">String to search for.</param>
        /// <param name="caseSensitive">If true, search is case sensitive.</param>
        /// <param name="isRegex">If true, treats string parameter as regex.</param>
        /// <returns>result (array of Page.SearchMatch): List of search matches.</returns>
        /// <see cref="https://developers.google.com/chrome-developer-tools/docs/protocol/1.0/debugger#command-searchInContent"/>
        public static Command SearchInContent(string scriptId, string query, bool caseSensitive = false, bool isRegex = false)
        {
            var com = new Command("Debugger.searchInContent");

            com.addParam("scriptId", scriptId);
            com.addParam("query", query);
            if (caseSensitive)
            {
                com.addParam("caseSensitive", caseSensitive);
            }
            if (isRegex)
            {
                com.addParam("isRegex", isRegex);
            }
            return(com);
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Removes JavaScript breakpoint.
        /// </summary>
        /// <param name="breakPointId">breakpointId</param>
        /// <returns></returns>
        /// <see cref="https://developers.google.com/chrome-developer-tools/docs/protocol/1.0/debugger#command-removeBreakpoint"/>
        public static Command RemoveBreakpoint(string breakPointId)
        {
            var com = new Command("Debugger.removeBreakpoint");

            com.addParam("breakpointId", breakPointId);
            return(com);
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Activates / deactivates all breakpoints on the page.
        /// </summary>
        /// <param name="active">New value for breakpoints active state.</param>
        /// <returns></returns>
        /// <see cref="https://developers.google.com/chrome-developer-tools/docs/protocol/1.0/debugger#command-setBreakpointsActive"/>
        public static Command SetBreakpointsActive(bool active)
        {
            var com = new Command("Debugger.setBreakpointsActive");

            com.addParam("active", active);
            return(com);
        }
Ejemplo n.º 23
0
        /// <summary>
        /// Specifies whether to always send extra HTTP headers with the requests from this page.
        /// </summary>
        /// <param name="headers">Map with extra HTTP headers.</param>
        /// <returns></returns>
        public static Command SetExtraHTTPHeaders(Dictionary <string, string> headers)
        {
            var com = new Command("Network.setExtraHTTPHeaders");

            com.addParam("headers", Command.GetJsonFromDictionary(headers));
            return(com);
        }
Ejemplo n.º 24
0
        /// <summary>
        /// Defines pause on exceptions state. Can be set to stop on all exceptions, uncaught exceptions or no exceptions.
        /// Initial pause on exceptions state is none.
        /// </summary>
        /// <param name="state">Pause on exceptions mode.</param>
        /// <returns></returns>
        /// <see cref="https://developers.google.com/chrome-developer-tools/docs/protocol/1.0/debugger#command-setPauseOnExceptions"/>
        public static Command SetPauseOnExceptions(State state)
        {
            var com = new Command("Debugger.setPauseOnExceptions");

            com.addParam("state", Enum.GetName(typeof(State), state));
            return(com);
        }
Ejemplo n.º 25
0
        /// <summary>
        /// Continues execution until specific location is reached.
        /// </summary>
        /// <param name="location">Location to continue to.</param>
        /// <returns></returns>
        /// <see cref="https://developers.google.com/chrome-developer-tools/docs/protocol/1.0/debugger#command-continueToLocation"/>
        public static Command ContinueToLocation(Location location)
        {
            var com = new Command("Debugger.continueToLocation");

            com.addParam("location", location);
            return(com);
        }
Ejemplo n.º 26
0
 /// <summary>
 /// Starts capturing instrumentation events.
 /// </summary>
 /// <param name="maxCallStackDepth">Samples JavaScript stack traces up to maxCallStackDepth, defaults to 5.</param>
 /// <returns></returns>
 public static Command Start(int? maxCallStackDepth = null)
 {
     var com = new Command("Timeline.start");
     if (maxCallStackDepth != null)
     {
         com.addParam("maxCallStackDepth", maxCallStackDepth);
     }
     return com;
 }
Ejemplo n.º 27
0
        /// <summary>
        /// Starts capturing instrumentation events.
        /// </summary>
        /// <param name="maxCallStackDepth">Samples JavaScript stack traces up to maxCallStackDepth, defaults to 5.</param>
        /// <returns></returns>
        public static Command Start(int?maxCallStackDepth = null)
        {
            var com = new Command("Timeline.start");

            if (maxCallStackDepth != null)
            {
                com.addParam("maxCallStackDepth", maxCallStackDepth);
            }
            return(com);
        }
Ejemplo n.º 28
0
 /// <summary>
 /// Navigates current page to the given URL.
 /// </summary>
 /// <param name="url">URL to navigate the page to.</param>
 /// <see cref="https://developers.google.com/chrome-developer-tools/docs/protocol/1.0/page#command-navigate"/>
 /// <returns></returns>
 public static Command Navigate(string url)
 {
     var com = new Command("Page.navigate");
     com.addParam("url", url);
     return com;
 }
Ejemplo n.º 29
0
 /// <summary>
 /// Continues execution until specific location is reached.
 /// </summary>
 /// <param name="location">Location to continue to.</param>
 /// <returns></returns>
 /// <see cref="https://developers.google.com/chrome-developer-tools/docs/protocol/1.0/debugger#command-continueToLocation"/>
 public static Command ContinueToLocation(Location location)
 {
     var com = new Command("Debugger.continueToLocation");
     com.addParam("location", location);
     return com;
 }
Ejemplo n.º 30
0
 /// <summary>
 /// Specifies whether to always send extra HTTP headers with the requests from this page.
 /// </summary>
 /// <param name="headers">Map with extra HTTP headers.</param>
 /// <returns></returns>
 public static Command SetExtraHTTPHeaders(Dictionary<string, string> headers)
 {
     var com = new Command("Network.setExtraHTTPHeaders");
     com.addParam("headers", Command.GetJsonFromDictionary(headers));
     return com;
 }
Ejemplo n.º 31
0
 /// <summary>
 /// Removes JavaScript breakpoint.
 /// </summary>
 /// <param name="breakPointId">breakpointId</param>
 /// <returns></returns>
 /// <see cref="https://developers.google.com/chrome-developer-tools/docs/protocol/1.0/debugger#command-removeBreakpoint"/>
 public static Command RemoveBreakpoint(string breakPointId)
 {
     var com = new Command("Debugger.removeBreakpoint");
     com.addParam("breakpointId", breakPointId);
     return com;
 }
Ejemplo n.º 32
0
 /// <summary>
 /// Searches for given string in script content.
 /// </summary>
 /// <param name="scriptId">Id of the script to search in.</param>
 /// <param name="query">String to search for.</param>
 /// <param name="caseSensitive">If true, search is case sensitive.</param>
 /// <param name="isRegex">If true, treats string parameter as regex.</param>
 /// <returns>result (array of Page.SearchMatch): List of search matches.</returns>
 /// <see cref="https://developers.google.com/chrome-developer-tools/docs/protocol/1.0/debugger#command-searchInContent"/>
 public static Command SearchInContent(string scriptId, string query, bool caseSensitive = false, bool isRegex = false)
 {
     var com = new Command("Debugger.searchInContent");
     com.addParam("scriptId", scriptId);
     com.addParam("query", query);
     if (caseSensitive)
     {
         com.addParam("caseSensitive", caseSensitive);
     }
     if (isRegex)
     {
         com.addParam("isRegex", isRegex);
     }
     return com;
 }
Ejemplo n.º 33
0
 /// <summary>
 /// Allows overriding user agent with the given string.
 /// </summary>
 /// <param name="userAgent"></param>
 /// <returns>userAgent (string): Useragent to use.</returns>
 public static Command SetUserAgentOverride(string userAgent)
 {
     var com = new Command("Network.setUserAgentOverride");
     com.addParam("userAgent", userAgent);
     return com;
 }
Ejemplo n.º 34
0
 /// <summary>
 /// Returns content served for the given request.
 /// </summary>
 /// <param name="requestId">Identifier of the network request to get content for.</param>
 /// <returns>body (string): Response body.
 /// base64Encoded (boolean): True, if content was sent as base64.</returns>
 public static Command GetResponseBody(string requestId)
 {
     var com = new Command("Network.getResponseBody");
     com.addParam("requestId", requestId);
     return com;
 }
Ejemplo n.º 35
0
 /// <summary>
 /// Sets JavaScript breakpoint at a given location.
 /// </summary>
 /// <param name="location">Location to set breakpoint in.</param>
 /// <param name="condition">Expression to use as a breakpoint condition. When specified, 
 /// debugger will only stop on the breakpoint if this expression evaluates to true.</param>
 /// <returns>breakpointId (string): Id of the created breakpoint for further reference.
 /// actualLocation (Location): Location this breakpoint resolved into.</returns>
 /// <see cref="https://developers.google.com/chrome-developer-tools/docs/protocol/1.0/debugger#command-setBreakpoint"/>
 public static Command SetBreakpoint(Location location, string condition = null)
 {
     var com = new Command("Debugger.setBreakpoint");
     com.addParam("location", location);
     if (condition != null)
     {
         com.addParam("condition", condition);
     }
     return com;
 }
Ejemplo n.º 36
0
 /// <summary>
 /// Sets JavaScript breakpoint at given location specified either by URL or URL regex. 
 /// Once this command is issued, all existing parsed scripts will have breakpoints resolved and 
 /// returned in locations property. Further matching script parsing will result in subsequent 
 /// breakpointResolved events issued. This logical breakpoint will survive page reloads.
 /// </summary>
 /// <param name="lineNumber">Line number to set breakpoint at.</param>
 /// <param name="url">URL of the resources to set breakpoint on.</param>
 /// <param name="urlRegex">Regex pattern for the URLs of the resources to set breakpoints on. 
 /// Either url or urlRegex must be specified.</param>
 /// <param name="columnNumber">Offset in the line to set breakpoint at.</param>
 /// <param name="condition">Expression to use as a breakpoint condition. 
 /// When specified, debugger will only stop on the breakpoint if this expression evaluates to true.</param>
 /// <returns>breakpointId (string): Id of the created breakpoint for further reference.
 /// locations (optional array of Location): List of the locations this breakpoint resolved into upon addition.</returns>
 /// <see cref="https://developers.google.com/chrome-developer-tools/docs/protocol/1.0/debugger#command-setBreakpointByUrl"/>
 public static Command SetBreakpointByUrl(
     int lineNumber,
     string url = null,
     string urlRegex = null,
     int? columnNumber = null,
     string condition = null)
 {
     if (url == null && urlRegex == null)
     {
         throw new ArgumentException("Either url or urlRegex must be specified.");
     }
     else
     {
         var com = new Command("Debugger.setBreakpointByUrl");
         com.addParam("lineNumber", lineNumber);
         if (url != null)
         {
             com.addParam("url", url);
         }
         if (urlRegex != null)
         {
             com.addParam("urlRegex", urlRegex);
         }
         if (columnNumber != null)
         {
             com.addParam("columnNumber", columnNumber);
         }
         if (condition != null)
         {
             com.addParam("condition", condition);
         }
         return com;
     }
 }
Ejemplo n.º 37
0
 /// <summary>
 /// Releases all remote objects that belong to a given group.
 /// </summary>
 /// <param name="objectGroup">Symbolic object group name.</param>
 /// <returns></returns>
 public static Command ReleaseObjectGroup(string objectGroup)
 {
     var com = new Command("Runtime.releaseObjectGroup");
     com.addParam("objectGroup", objectGroup);
     return com;
 }
Ejemplo n.º 38
0
 /// <summary>
 /// Activates / deactivates all breakpoints on the page.
 /// </summary>
 /// <param name="active">New value for breakpoints active state.</param>
 /// <returns></returns>
 /// <see cref="https://developers.google.com/chrome-developer-tools/docs/protocol/1.0/debugger#command-setBreakpointsActive"/>
 public static Command SetBreakpointsActive(bool active)
 {
     var com = new Command("Debugger.setBreakpointsActive");
     com.addParam("active", active);
     return com;
 }
Ejemplo n.º 39
0
 /// <summary>
 /// Edits JavaScript source live.
 /// </summary>
 /// <param name="scriptId">Id of the script to edit.</param>
 /// <param name="scriptSource">New content of the script.</param>
 /// <returns>callFrames (optional array of CallFrame): New stack trace in case editing has happened while VM was stopped.</returns>
 /// <see cref="https://developers.google.com/chrome-developer-tools/docs/protocol/1.0/debugger#command-setScriptSource"/>
 public static Command SetScriptSource(string scriptId, string scriptSource)
 {
     var com = new Command("Debugger.setScriptSource");
     com.addParam("scriptId", scriptId);
     com.addParam("scriptSource", scriptSource);
     return com;
 }
Ejemplo n.º 40
0
 /// <summary>
 /// Defines pause on exceptions state. Can be set to stop on all exceptions, uncaught exceptions or no exceptions. 
 /// Initial pause on exceptions state is none.
 /// </summary>
 /// <param name="state">Pause on exceptions mode.</param>
 /// <returns></returns>
 /// <see cref="https://developers.google.com/chrome-developer-tools/docs/protocol/1.0/debugger#command-setPauseOnExceptions"/>
 public static Command SetPauseOnExceptions(State state)
 {
     var com = new Command("Debugger.setPauseOnExceptions");
     com.addParam("state", Enum.GetName(typeof(State), state));
     return com;
 }
Ejemplo n.º 41
0
 /// <summary>
 /// Toggles ignoring cache for each request. If true, cache will not be used.
 /// </summary>
 /// <param name="cacheDisabled">Cache disabled state.</param>
 /// <returns></returns>
 public static Command SetCacheDisabled(bool cacheDisabled)
 {
     var com = new Command("Network.setCacheDisabled");
     com.addParam("cacheDisabled", cacheDisabled);
     return com;
 }
Ejemplo n.º 42
0
 /// <summary>
 /// Releases remote object with given id.
 /// </summary>
 /// <param name="objectId">Identifier of the object to release.</param>
 /// <returns></returns>
 public static Command ReleaseObject(string objectId)
 {
     var com = new Command("Runtime.releaseObject");
     com.addParam("objectId", objectId);
     return com;
 }