Class Debugger
- java.lang.Object
-
- org.openqa.selenium.devtools.v103.debugger.Debugger
-
public class Debugger extends java.lang.Object
Debugger domain exposes JavaScript debugging capabilities. It allows setting and removing breakpoints, stepping through execution, exploring stack traces, etc.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Debugger.ContinueToLocationTargetCallFrames
static class
Debugger.EvaluateOnCallFrameResponse
static class
Debugger.GetScriptSourceResponse
static class
Debugger.RestartFrameResponse
static class
Debugger.SetBreakpointByUrlResponse
static class
Debugger.SetBreakpointResponse
static class
Debugger.SetInstrumentationBreakpointInstrumentation
static class
Debugger.SetPauseOnExceptionsState
static class
Debugger.SetScriptSourceResponse
-
Constructor Summary
Constructors Constructor Description Debugger()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static org.openqa.selenium.devtools.Event<BreakpointResolved>
breakpointResolved()
static org.openqa.selenium.devtools.Command<java.lang.Void>
continueToLocation(Location location, java.util.Optional<Debugger.ContinueToLocationTargetCallFrames> targetCallFrames)
Continues execution until specific location is reached.static org.openqa.selenium.devtools.Command<java.lang.Void>
disable()
Disables debugger for given page.static org.openqa.selenium.devtools.Command<UniqueDebuggerId>
enable(java.util.Optional<java.lang.Number> maxScriptsCacheSize)
Enables debugger for the given page.static org.openqa.selenium.devtools.Command<Debugger.EvaluateOnCallFrameResponse>
evaluateOnCallFrame(CallFrameId callFrameId, java.lang.String expression, java.util.Optional<java.lang.String> objectGroup, java.util.Optional<java.lang.Boolean> includeCommandLineAPI, java.util.Optional<java.lang.Boolean> silent, java.util.Optional<java.lang.Boolean> returnByValue, java.util.Optional<java.lang.Boolean> generatePreview, java.util.Optional<java.lang.Boolean> throwOnSideEffect, java.util.Optional<TimeDelta> timeout)
Evaluates expression on a given call frame.static org.openqa.selenium.devtools.Command<java.util.List<BreakLocation>>
getPossibleBreakpoints(Location start, java.util.Optional<Location> end, java.util.Optional<java.lang.Boolean> restrictToFunction)
Returns possible locations for breakpoint.static org.openqa.selenium.devtools.Command<Debugger.GetScriptSourceResponse>
getScriptSource(ScriptId scriptId)
Returns source for the script with given id.static org.openqa.selenium.devtools.Command<StackTrace>
getStackTrace(StackTraceId stackTraceId)
Returns stack trace with given `stackTraceId`.static org.openqa.selenium.devtools.Command<java.lang.String>
getWasmBytecode(ScriptId scriptId)
Deprecated.static org.openqa.selenium.devtools.Command<java.lang.Void>
pause()
Stops on the next JavaScript statement.static org.openqa.selenium.devtools.Event<Paused>
paused()
static org.openqa.selenium.devtools.Command<java.lang.Void>
pauseOnAsyncCall(StackTraceId parentStackTraceId)
Deprecated.static org.openqa.selenium.devtools.Command<java.lang.Void>
removeBreakpoint(BreakpointId breakpointId)
Removes JavaScript breakpoint.static org.openqa.selenium.devtools.Command<Debugger.RestartFrameResponse>
restartFrame(CallFrameId callFrameId)
Deprecated.static org.openqa.selenium.devtools.Command<java.lang.Void>
resume(java.util.Optional<java.lang.Boolean> terminateOnResume)
Resumes JavaScript execution.static org.openqa.selenium.devtools.Event<java.lang.Void>
resumed()
static org.openqa.selenium.devtools.Event<ScriptFailedToParse>
scriptFailedToParse()
static org.openqa.selenium.devtools.Event<ScriptParsed>
scriptParsed()
static org.openqa.selenium.devtools.Command<java.util.List<SearchMatch>>
searchInContent(ScriptId scriptId, java.lang.String query, java.util.Optional<java.lang.Boolean> caseSensitive, java.util.Optional<java.lang.Boolean> isRegex)
Searches for given string in script content.static org.openqa.selenium.devtools.Command<java.lang.Void>
setAsyncCallStackDepth(java.lang.Integer maxDepth)
Enables or disables async call stacks tracking.static org.openqa.selenium.devtools.Command<java.lang.Void>
setBlackboxedRanges(ScriptId scriptId, java.util.List<ScriptPosition> positions)
Makes backend skip steps in the script in blackboxed ranges.static org.openqa.selenium.devtools.Command<java.lang.Void>
setBlackboxPatterns(java.util.List<java.lang.String> patterns)
Replace previous blackbox patterns with passed ones.static org.openqa.selenium.devtools.Command<Debugger.SetBreakpointResponse>
setBreakpoint(Location location, java.util.Optional<java.lang.String> condition)
Sets JavaScript breakpoint at a given location.static org.openqa.selenium.devtools.Command<Debugger.SetBreakpointByUrlResponse>
setBreakpointByUrl(java.lang.Integer lineNumber, java.util.Optional<java.lang.String> url, java.util.Optional<java.lang.String> urlRegex, java.util.Optional<java.lang.String> scriptHash, java.util.Optional<java.lang.Integer> columnNumber, java.util.Optional<java.lang.String> condition)
Sets JavaScript breakpoint at given location specified either by URL or URL regex.static org.openqa.selenium.devtools.Command<BreakpointId>
setBreakpointOnFunctionCall(RemoteObjectId objectId, java.util.Optional<java.lang.String> condition)
Sets JavaScript breakpoint before each call to the given function.static org.openqa.selenium.devtools.Command<java.lang.Void>
setBreakpointsActive(java.lang.Boolean active)
Activates / deactivates all breakpoints on the page.static org.openqa.selenium.devtools.Command<BreakpointId>
setInstrumentationBreakpoint(Debugger.SetInstrumentationBreakpointInstrumentation instrumentation)
Sets instrumentation breakpoint.static org.openqa.selenium.devtools.Command<java.lang.Void>
setPauseOnExceptions(Debugger.SetPauseOnExceptionsState state)
Defines pause on exceptions state.static org.openqa.selenium.devtools.Command<java.lang.Void>
setReturnValue(CallArgument newValue)
Changes return value in top frame.static org.openqa.selenium.devtools.Command<Debugger.SetScriptSourceResponse>
setScriptSource(ScriptId scriptId, java.lang.String scriptSource, java.util.Optional<java.lang.Boolean> dryRun)
Edits JavaScript source live.static org.openqa.selenium.devtools.Command<java.lang.Void>
setSkipAllPauses(java.lang.Boolean skip)
Makes page not interrupt on any pauses (breakpoint, exception, dom exception etc).static org.openqa.selenium.devtools.Command<java.lang.Void>
setVariableValue(java.lang.Integer scopeNumber, java.lang.String variableName, CallArgument newValue, CallFrameId callFrameId)
Changes value of variable in a callframe.static org.openqa.selenium.devtools.Command<java.lang.Void>
stepInto(java.util.Optional<java.lang.Boolean> breakOnAsyncCall, java.util.Optional<java.util.List<LocationRange>> skipList)
Steps into the function call.static org.openqa.selenium.devtools.Command<java.lang.Void>
stepOut()
Steps out of the function call.static org.openqa.selenium.devtools.Command<java.lang.Void>
stepOver(java.util.Optional<java.util.List<LocationRange>> skipList)
Steps over the statement.
-
-
-
Method Detail
-
continueToLocation
public static org.openqa.selenium.devtools.Command<java.lang.Void> continueToLocation(Location location, java.util.Optional<Debugger.ContinueToLocationTargetCallFrames> targetCallFrames)
Continues execution until specific location is reached.
-
disable
public static org.openqa.selenium.devtools.Command<java.lang.Void> disable()
Disables debugger for given page.
-
enable
public static org.openqa.selenium.devtools.Command<UniqueDebuggerId> enable(java.util.Optional<java.lang.Number> maxScriptsCacheSize)
Enables debugger for the given page. Clients should not assume that the debugging has been enabled until the result for this command is received.
-
evaluateOnCallFrame
public static org.openqa.selenium.devtools.Command<Debugger.EvaluateOnCallFrameResponse> evaluateOnCallFrame(CallFrameId callFrameId, java.lang.String expression, java.util.Optional<java.lang.String> objectGroup, java.util.Optional<java.lang.Boolean> includeCommandLineAPI, java.util.Optional<java.lang.Boolean> silent, java.util.Optional<java.lang.Boolean> returnByValue, java.util.Optional<java.lang.Boolean> generatePreview, java.util.Optional<java.lang.Boolean> throwOnSideEffect, java.util.Optional<TimeDelta> timeout)
Evaluates expression on a given call frame.
-
getPossibleBreakpoints
public static org.openqa.selenium.devtools.Command<java.util.List<BreakLocation>> getPossibleBreakpoints(Location start, java.util.Optional<Location> end, java.util.Optional<java.lang.Boolean> restrictToFunction)
Returns possible locations for breakpoint. scriptId in start and end range locations should be the same.
-
getScriptSource
public static org.openqa.selenium.devtools.Command<Debugger.GetScriptSourceResponse> getScriptSource(ScriptId scriptId)
Returns source for the script with given id.
-
getWasmBytecode
@Deprecated public static org.openqa.selenium.devtools.Command<java.lang.String> getWasmBytecode(ScriptId scriptId)
Deprecated.This command is deprecated. Use getScriptSource instead.
-
getStackTrace
@Beta public static org.openqa.selenium.devtools.Command<StackTrace> getStackTrace(StackTraceId stackTraceId)
Returns stack trace with given `stackTraceId`.
-
pause
public static org.openqa.selenium.devtools.Command<java.lang.Void> pause()
Stops on the next JavaScript statement.
-
pauseOnAsyncCall
@Beta @Deprecated public static org.openqa.selenium.devtools.Command<java.lang.Void> pauseOnAsyncCall(StackTraceId parentStackTraceId)
Deprecated.
-
removeBreakpoint
public static org.openqa.selenium.devtools.Command<java.lang.Void> removeBreakpoint(BreakpointId breakpointId)
Removes JavaScript breakpoint.
-
restartFrame
@Deprecated public static org.openqa.selenium.devtools.Command<Debugger.RestartFrameResponse> restartFrame(CallFrameId callFrameId)
Deprecated.Restarts particular call frame from the beginning.
-
resume
public static org.openqa.selenium.devtools.Command<java.lang.Void> resume(java.util.Optional<java.lang.Boolean> terminateOnResume)
Resumes JavaScript execution.
-
searchInContent
public static org.openqa.selenium.devtools.Command<java.util.List<SearchMatch>> searchInContent(ScriptId scriptId, java.lang.String query, java.util.Optional<java.lang.Boolean> caseSensitive, java.util.Optional<java.lang.Boolean> isRegex)
Searches for given string in script content.
-
setAsyncCallStackDepth
public static org.openqa.selenium.devtools.Command<java.lang.Void> setAsyncCallStackDepth(java.lang.Integer maxDepth)
Enables or disables async call stacks tracking.
-
setBlackboxPatterns
@Beta public static org.openqa.selenium.devtools.Command<java.lang.Void> setBlackboxPatterns(java.util.List<java.lang.String> patterns)
Replace previous blackbox patterns with passed ones. Forces backend to skip stepping/pausing in scripts with url matching one of the patterns. VM will try to leave blackboxed script by performing 'step in' several times, finally resorting to 'step out' if unsuccessful.
-
setBlackboxedRanges
@Beta public static org.openqa.selenium.devtools.Command<java.lang.Void> setBlackboxedRanges(ScriptId scriptId, java.util.List<ScriptPosition> positions)
Makes backend skip steps in the script in blackboxed ranges. VM will try leave blacklisted scripts by performing 'step in' several times, finally resorting to 'step out' if unsuccessful. Positions array contains positions where blackbox state is changed. First interval isn't blackboxed. Array should be sorted.
-
setBreakpoint
public static org.openqa.selenium.devtools.Command<Debugger.SetBreakpointResponse> setBreakpoint(Location location, java.util.Optional<java.lang.String> condition)
Sets JavaScript breakpoint at a given location.
-
setInstrumentationBreakpoint
public static org.openqa.selenium.devtools.Command<BreakpointId> setInstrumentationBreakpoint(Debugger.SetInstrumentationBreakpointInstrumentation instrumentation)
Sets instrumentation breakpoint.
-
setBreakpointByUrl
public static org.openqa.selenium.devtools.Command<Debugger.SetBreakpointByUrlResponse> setBreakpointByUrl(java.lang.Integer lineNumber, java.util.Optional<java.lang.String> url, java.util.Optional<java.lang.String> urlRegex, java.util.Optional<java.lang.String> scriptHash, java.util.Optional<java.lang.Integer> columnNumber, java.util.Optional<java.lang.String> condition)
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.
-
setBreakpointOnFunctionCall
@Beta public static org.openqa.selenium.devtools.Command<BreakpointId> setBreakpointOnFunctionCall(RemoteObjectId objectId, java.util.Optional<java.lang.String> condition)
Sets JavaScript breakpoint before each call to the given function. If another function was created from the same source as a given one, calling it will also trigger the breakpoint.
-
setBreakpointsActive
public static org.openqa.selenium.devtools.Command<java.lang.Void> setBreakpointsActive(java.lang.Boolean active)
Activates / deactivates all breakpoints on the page.
-
setPauseOnExceptions
public static org.openqa.selenium.devtools.Command<java.lang.Void> setPauseOnExceptions(Debugger.SetPauseOnExceptionsState state)
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`.
-
setReturnValue
@Beta public static org.openqa.selenium.devtools.Command<java.lang.Void> setReturnValue(CallArgument newValue)
Changes return value in top frame. Available only at return break position.
-
setScriptSource
public static org.openqa.selenium.devtools.Command<Debugger.SetScriptSourceResponse> setScriptSource(ScriptId scriptId, java.lang.String scriptSource, java.util.Optional<java.lang.Boolean> dryRun)
Edits JavaScript source live.
-
setSkipAllPauses
public static org.openqa.selenium.devtools.Command<java.lang.Void> setSkipAllPauses(java.lang.Boolean skip)
Makes page not interrupt on any pauses (breakpoint, exception, dom exception etc).
-
setVariableValue
public static org.openqa.selenium.devtools.Command<java.lang.Void> setVariableValue(java.lang.Integer scopeNumber, java.lang.String variableName, CallArgument newValue, CallFrameId callFrameId)
Changes value of variable in a callframe. Object-based scopes are not supported and must be mutated manually.
-
stepInto
public static org.openqa.selenium.devtools.Command<java.lang.Void> stepInto(java.util.Optional<java.lang.Boolean> breakOnAsyncCall, java.util.Optional<java.util.List<LocationRange>> skipList)
Steps into the function call.
-
stepOut
public static org.openqa.selenium.devtools.Command<java.lang.Void> stepOut()
Steps out of the function call.
-
stepOver
public static org.openqa.selenium.devtools.Command<java.lang.Void> stepOver(java.util.Optional<java.util.List<LocationRange>> skipList)
Steps over the statement.
-
breakpointResolved
public static org.openqa.selenium.devtools.Event<BreakpointResolved> breakpointResolved()
-
paused
public static org.openqa.selenium.devtools.Event<Paused> paused()
-
resumed
public static org.openqa.selenium.devtools.Event<java.lang.Void> resumed()
-
scriptFailedToParse
public static org.openqa.selenium.devtools.Event<ScriptFailedToParse> scriptFailedToParse()
-
scriptParsed
public static org.openqa.selenium.devtools.Event<ScriptParsed> scriptParsed()
-
-