← Back to Debugger domain

Debugger.setBreakpointByUrl

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.

Domain: Debugger stable

Parameters

NameTypeDescription
lineNumberintegerLine number to set breakpoint at.
url (optional)stringURL of the resources to set breakpoint on.
urlRegex (optional)stringRegex pattern for the URLs of the resources to set breakpoints on. Either `url` or `urlRegex` must be specified.
scriptHash (optional)stringScript hash of the resources to set breakpoint on.
columnNumber (optional)integerOffset in the line to set breakpoint at.
condition (optional)stringExpression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true.

Returns

NameTypeDescription
breakpointIdBreakpointIdId of the created breakpoint for further reference.
locationsarrayList of the locations this breakpoint resolved into upon addition.

Example Request

{
  "id": 1,
  "method": "Debugger.setBreakpointByUrl",
  "params": {
    "lineNumber": 0
  }
}

Example Response

{
  "id": 1,
  "result": {
    "breakpointId": "breakpointId-value",
    "locations": []
  }
}

Usage in Node.js

const result = await send('Debugger.setBreakpointByUrl', {"lineNumber": 0});
console.log(result);
// {"breakpointId": "breakpointId-value", "locations": []}