Package Torello.Browser
Class Debugger
- java.lang.Object
-
- Torello.Browser.Debugger
-
public class Debugger extends java.lang.Object
Class created byAutomatic Code-Generator
.
This class was built using the Chrome Remote Dev-Tools A.P.I., which is specified by two JSON-RPC Files. These files were obtained from the Chrome Dev Tools Protocol Git Hub Page, which has a "Tip of Tree" (the latest) API-Specification Page Here: JSON-RPC Protocol Specification.
JSON-Viewable Google-API:
These files may be viewed here: browser_protocol.json and js_protocol.json.
These files were converted into this Java-Browser (CDT) Library; they are a Java-Alternative to the Node.js implementation.
HTML-Viewable API:
In addition to this Class-Library, these files were also converted to a simple HTML Page, which may be browsed here: Browser API Web-PageNode.js
RDP-API Implementation:
You may read about theNode.js Chrome Remote Interface
on the Node.js Package Manager Web-Site: NPM
Debugger domain exposes JavaScript debugging capabilities. It allows setting and removing breakpoints, stepping through execution, exploring stack traces, etc.This class is intended to be used with a Headless Browser
These methods have been tested, to some degree, using Google Chrome. In order to use this class you must start a web-browser instance and make a connection to the browser using aRemote Debugging Port
. The initializations may be accomplished using classBRDPC
(Browser Remote Debug Protocol Connection).
Google-Chrome was used during the development process of the classes in this particular package. Note that, lately, it has been asserted Microsoft has switched to using the Chrome-Engine for its Microsoft Edge Browser Internal Code-Base. Therefore, there may limited support / functionality when running the methods in this class with Microsoft-Edge. There is the possibility these will work with Opera & Safari.
Check whether the your Web-Browser will allow itself to be driven by theWeb-Socket RDP-Port 9223
.
Foreign Function API:
Every one of the methods that reside in this class are designed to do nothing more than:- Accept Parameters from the User, and "Marshall Them" into a Valid JSON-Request
- Transmit the Marshalled Request-JSON to a Headless Web-Browser over a Web-Socket RDP Connection
- Receive BOTH that Method's Results AND any Browser Event-Firings from the Web-Socket
- Parse JSON Method-Results and Browser-Event Firings, and Subsequently Convert them to Standard Java-Types
- Report these Method-Results and Browser-Events to the User via an User-Registered Event-Listener or a Promise Object
Java-HTML Difference:
Unlike the bulk of the Java HTML JAR Library, there is very little native Java-Code, and very little testing that may be done on any of the classes & methods in this package. The code inside these classes does nothing more than marshall-and-unmarshall Java-Types into Json-Requests (and vice-versa). The Java-Script & Browser modules inside of a Google-Chrome instance are, theoretically, handling these requests, and returning their results (or events) over the Web-Socket Connection.
It has been asserted (by Google Chrome Developers) that some of these methods are only "partially working" or "experimental".
Hi-Lited Source-Code:- View Here: Torello/Browser/Debugger.java
- Open New Browser-Tab: Torello/Browser/Debugger.java
File Size: 141,569 Bytes Line Count: 3,367 '\n' Characters Found
Stateless Class:This class neither contains any program-state, nor can it be instantiated. The@StaticFunctional
Annotation may also be called 'The Spaghetti Report'.Static-Functional
classes are, essentially, C-Styled Files, without any constructors or non-static member fields. It is a concept very similar to the Java-Bean's@Stateless
Annotation.
- 1 Constructor(s), 1 declared private, zero-argument constructor
- 30 Method(s), 30 declared static
- 6 Field(s), 6 declared static, 5 declared final
- Fields excused from final modifier (with explanation):
Field 'counter' is not final. Reason: CONFIGURATION
-
-
Nested Class Summary
Type Classes: Debugger Domain Types Modifier and Type Inner-Class static class
Debugger.BreakLocation
[No Description Provided by Google]
static class
Debugger.CallFrame
JavaScript call frame.static class
Debugger.DebugSymbols
Debug symbols available for a wasm script.static class
Debugger.Location
Location in the source code.static class
Debugger.LocationRange
Location range within one script.static class
Debugger.Scope
Scope description.static class
Debugger.ScriptPosition
Location in the source code.static class
Debugger.SearchMatch
Search match for resource.Event Classes: Debugger Domain Events Modifier and Type Inner-Class static class
Debugger.breakpointResolved
Fired when breakpoint is resolved to an actual script and location.static class
Debugger.paused
Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria.static class
Debugger.resumed
Fired when the virtual machine resumed execution.static class
Debugger.scriptFailedToParse
Fired when virtual machine fails to parse the script.static class
Debugger.scriptParsed
Fired when virtual machine parses script.
-
Field Summary
Debugger Domain Enumerated String Types Modifier and Type Field static String[]
ScriptLanguage
Enum of possible script languages.
-
Method Summary
Debugger Domain Commands Script Returns Modifier and Type Method NONE ( void
)static Script<>
continueToLocation(Debugger.Location location, String targetCallFrames)
Continues execution until specific location is reached.NONE ( void
)static Script<>
disable()
Disables debugger for given page.String
static Script<>
enable(Number maxScriptsCacheSize)
Enables debugger for the given page.Ret2<RunTime.RemoteObject,
RunTime.ExceptionDetails>static Script<>
evaluateOnCallFrame(String callFrameId, String expression, String objectGroup, Boolean includeCommandLineAPI, Boolean silent, Boolean returnByValue, Boolean generatePreview, Boolean throwOnSideEffect, Number timeout)
Evaluates expression on a given call frame.Debugger.BreakLocation[]
static Script<>
getPossibleBreakpoints(Debugger.Location start, Debugger.Location end, Boolean restrictToFunction)
Returns possible locations for breakpoint.Ret2<String,
String>static Script<>
getScriptSource(String scriptId)
Returns source for the script with given id.RunTime.StackTrace
static Script<>
getStackTrace(RunTime.StackTraceId stackTraceId)
Returns stack trace with givenstackTraceId
.String
static Script<>
getWasmBytecode(String scriptId)
This command is deprecated.NONE ( void
)static Script<>
pause()
Stops on the next JavaScript statement.NONE ( void
)static Script<>
pauseOnAsyncCall(RunTime.StackTraceId parentStackTraceId)
[No Description Provided by Google]
EXPERIMENTAL
DEPRECATEDNONE ( void
)static Script<>
removeBreakpoint(String breakpointId)
Removes JavaScript breakpoint.Ret3<Debugger.CallFrame[],
RunTime.StackTrace,
RunTime.StackTraceId>static Script<>
restartFrame(String callFrameId)
Restarts particular call frame from the beginning.NONE ( void
)static Script<>
resume(Boolean terminateOnResume)
Resumes JavaScript execution.Debugger.SearchMatch[]
static Script<>
searchInContent(String scriptId, String query, Boolean caseSensitive, Boolean isRegex)
Searches for given string in script content.NONE ( void
)static Script<>
setAsyncCallStackDepth(int maxDepth)
Enables or disables async call stacks tracking.NONE ( void
)static Script<>
setBlackboxedRanges(String scriptId, Debugger.ScriptPosition[] positions)
Makes backend skip steps in the script in blackboxed ranges.NONE ( void
)static Script<>
setBlackboxPatterns(String[] patterns)
Replace previous blackbox patterns with passed ones.Ret2<String,
Debugger.Location>static Script<>
setBreakpoint(Debugger.Location location, String condition)
Sets JavaScript breakpoint at a given location.Ret2<String,
Debugger.Location[]>static Script<>
setBreakpointByUrl(int lineNumber, String url, String urlRegex, String scriptHash, Integer columnNumber, String condition)
Sets JavaScript breakpoint at given location specified either by URL or URL regex.String
static Script<>
setBreakpointOnFunctionCall(String objectId, String condition)
Sets JavaScript breakpoint before each call to the given function.NONE ( void
)static Script<>
setBreakpointsActive(boolean active)
Activates / deactivates all breakpoints on the page.String
static Script<>
setInstrumentationBreakpoint(String instrumentation)
Sets instrumentation breakpoint.NONE ( void
)static Script<>
setPauseOnExceptions(String state)
Defines pause on exceptions state.NONE ( void
)static Script<>
setReturnValue(RunTime.CallArgument newValue)
Changes return value in top frame.Ret5<Debugger.CallFrame[],
Boolean,
RunTime.StackTrace,
RunTime.StackTraceId,
RunTime.ExceptionDetails>static Script<>
setScriptSource(String scriptId, String scriptSource, Boolean dryRun)
Edits JavaScript source live.NONE ( void
)static Script<>
setSkipAllPauses(boolean skip)
Makes page not interrupt on any pauses (breakpoint, exception, dom exception etc).NONE ( void
)static Script<>
setVariableValue(int scopeNumber, String variableName, RunTime.CallArgument newValue, String callFrameId)
Changes value of variable in a callframe.NONE ( void
)static Script<>
stepInto(Boolean breakOnAsyncCall, Debugger.LocationRange[] skipList)
Steps into the function call.NONE ( void
)static Script<>
stepOut()
Steps out of the function call.NONE ( void
)static Script<>
stepOver(Debugger.LocationRange[] skipList)
Steps over the statement.
-
-
-
Field Detail
-
ScriptLanguage
public static final java.lang.String[] ScriptLanguage
Enum of possible script languages.
-
-
Method Detail
-
continueToLocation
public static Script<java.lang.String,JsonObject,Ret0> continueToLocation (Debugger.Location location, java.lang.String targetCallFrames)
Continues execution until specific location is reached.- Parameters:
location
- Location to continue to.targetCallFrames
- -
Acceptable Values: ["any", "current"]
OPTIONAL- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
disable
public static Script<java.lang.String,JsonObject,Ret0> disable()
Disables debugger for given page.- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
enable
public static Script<java.lang.String,JsonObject,java.lang.String> enable (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.- Parameters:
maxScriptsCacheSize
- The maximum size in bytes of collected scripts (not referenced by other heap objects) the debugger can hold. Puts no limit if parameter is omitted.
OPTIONAL
EXPERIMENTAL- Returns:
- An instance of
Script
<String,JsonObject
, String>
This script may be executed, usingScript.exec()
, and afterwards, aPromise
<JsonObject, String>
will be returned.
Finally, thePromise
may be awaited, usingPromise.await()
, and the returned result of this Browser Function may may be retrieved.
This Browser Function returnsString (debuggerId
)
Unique identifier of the debugger.
-
evaluateOnCallFrame
public static Script<java.lang.String,JsonObject,Ret2<RunTime.RemoteObject,RunTime.ExceptionDetails>> evaluateOnCallFrame (java.lang.String callFrameId, java.lang.String expression, java.lang.String objectGroup, java.lang.Boolean includeCommandLineAPI, java.lang.Boolean silent, java.lang.Boolean returnByValue, java.lang.Boolean generatePreview, java.lang.Boolean throwOnSideEffect, java.lang.Number timeout)
Evaluates expression on a given call frame.- Parameters:
callFrameId
- Call frame identifier to evaluate on.expression
- Expression to evaluate.objectGroup
- String object group name to put result into (allows rapid releasing resulting object handles usingreleaseObjectGroup
).
OPTIONALincludeCommandLineAPI
- Specifies whether command line API should be available to the evaluated expression, defaults to false.
OPTIONALsilent
- In silent mode exceptions thrown during evaluation are not reported and do not pause execution. OverridessetPauseOnException
state.
OPTIONALreturnByValue
- Whether the result is expected to be a JSON object that should be sent by value.
OPTIONALgeneratePreview
- Whether preview should be generated for the result.
OPTIONAL
EXPERIMENTALthrowOnSideEffect
- Whether to throw an exception if side effect cannot be ruled out during evaluation.
OPTIONALtimeout
- Terminate execution after timing out (number of milliseconds).
OPTIONAL
EXPERIMENTAL- Returns:
- An instance of
Script
<String,JsonObject
,Ret2
>
ThisScript
may be executed (usingScript.exec()
), and aPromise
returned.
When thePromise
is awaited (usingPromise.await()
), theRet2
will subsequently be returned from that call.
The returned values are encapsulated in an instance ofRet2
Ret2.a:
RunTime.RemoteObject
(result)
Object wrapper for the evaluation result.Ret2.b:
RunTime.ExceptionDetails
(exceptionDetails)
Exception details.
-
getPossibleBreakpoints
public static Script<java.lang.String,JsonObject,Debugger.BreakLocation[]> getPossibleBreakpoints (Debugger.Location start, Debugger.Location end, java.lang.Boolean restrictToFunction)
Returns possible locations for breakpoint. scriptId in start and end range locations should be the same.- Parameters:
start
- Start of range to search possible breakpoint locations in.end
- End of range to search possible breakpoint locations in (excluding). When not specified, end of scripts is used as end of range.
OPTIONALrestrictToFunction
- Only consider locations which are in the same (non-nested) function as start.
OPTIONAL- Returns:
- An instance of
Script
<String,JsonObject
,Debugger.BreakLocation
[]>
This script may be executed, usingScript.exec()
, and afterwards, aPromise
<JsonObject,
will be returned.Debugger.BreakLocation
[]>
Finally, thePromise
may be awaited, usingPromise.await()
, and the returned result of this Browser Function may may be retrieved.
This Browser Function returns
)Debugger.BreakLocation
[] (locations
List of the possible breakpoint locations.
-
getScriptSource
public static Script<java.lang.String,JsonObject,Ret2<java.lang.String,java.lang.String>> getScriptSource (java.lang.String scriptId)
Returns source for the script with given id.- Parameters:
scriptId
- Id of the script to get source for.- Returns:
- An instance of
Script
<String,JsonObject
,Ret2
>
ThisScript
may be executed (usingScript.exec()
), and aPromise
returned.
When thePromise
is awaited (usingPromise.await()
), theRet2
will subsequently be returned from that call.
The returned values are encapsulated in an instance ofRet2
Ret2.a: String (scriptSource)
Script source (empty in case of Wasm bytecode).Ret2.b: String (bytecode)
Wasm bytecode. (Encoded as a base64 string when passed over JSON)
-
getWasmBytecode
public static Script<java.lang.String,JsonObject,java.lang.String> getWasmBytecode (java.lang.String scriptId)
This command is deprecated. Use getScriptSource instead.
DEPRECATED- Parameters:
scriptId
- Id of the Wasm script to get source for.- Returns:
- An instance of
Script
<String,JsonObject
, String>
This script may be executed, usingScript.exec()
, and afterwards, aPromise
<JsonObject, String>
will be returned.
Finally, thePromise
may be awaited, usingPromise.await()
, and the returned result of this Browser Function may may be retrieved.
This Browser Function returnsString (bytecode
)
Script source. (Encoded as a base64 string when passed over JSON)
-
getStackTrace
public static Script<java.lang.String,JsonObject,RunTime.StackTrace> getStackTrace (RunTime.StackTraceId stackTraceId)
Returns stack trace with givenstackTraceId
.
EXPERIMENTAL- Parameters:
stackTraceId
- -- Returns:
- An instance of
Script
<String,JsonObject
,RunTime.StackTrace
>
This script may be executed, usingScript.exec()
, and afterwards, aPromise
<JsonObject,
will be returned.RunTime.StackTrace
>
Finally, thePromise
may be awaited, usingPromise.await()
, and the returned result of this Browser Function may may be retrieved.
This Browser Function returns
)RunTime.StackTrace
(stackTrace
-
-
pause
public static Script<java.lang.String,JsonObject,Ret0> pause()
Stops on the next JavaScript statement.- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
pauseOnAsyncCall
public static Script<java.lang.String,JsonObject,Ret0> pauseOnAsyncCall (RunTime.StackTraceId parentStackTraceId)
[No Description Provided by Google]
EXPERIMENTAL
DEPRECATED- Parameters:
parentStackTraceId
- Debugger will pause when async call with given stack trace is started.- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
removeBreakpoint
public static Script<java.lang.String,JsonObject,Ret0> removeBreakpoint (java.lang.String breakpointId)
Removes JavaScript breakpoint.- Parameters:
breakpointId
- -- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
restartFrame
public static Script<java.lang.String,JsonObject,Ret3<Debugger.CallFrame[],RunTime.StackTrace,RunTime.StackTraceId>> restartFrame (java.lang.String callFrameId)
Restarts particular call frame from the beginning.
DEPRECATED- Parameters:
callFrameId
- Call frame identifier to evaluate on.- Returns:
- An instance of
Script
<String,JsonObject
,Ret3
>
ThisScript
may be executed (usingScript.exec()
), and aPromise
returned.
When thePromise
is awaited (usingPromise.await()
), theRet3
will subsequently be returned from that call.
The returned values are encapsulated in an instance ofRet3
Ret3.a:
Debugger.CallFrame
[] (callFrames)
New stack trace.Ret3.b:
RunTime.StackTrace
(asyncStackTrace)
Async stack trace, if any.Ret3.c:
RunTime.StackTraceId
(asyncStackTraceId)
Async stack trace, if any.
-
resume
public static Script<java.lang.String,JsonObject,Ret0> resume (java.lang.Boolean terminateOnResume)
Resumes JavaScript execution.- Parameters:
terminateOnResume
- Set to true to terminate execution upon resuming execution. In contrast to RunTime.terminateExecution, this will allows to execute further JavaScript (i.e. via evaluation) until execution of the paused code is actually resumed, at which point termination is triggered. If execution is currently not paused, this parameter has no effect.
OPTIONAL- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
searchInContent
public static Script<java.lang.String,JsonObject,Debugger.SearchMatch[]> searchInContent (java.lang.String scriptId, java.lang.String query, java.lang.Boolean caseSensitive, java.lang.Boolean isRegex)
Searches for given string in script content.- Parameters:
scriptId
- Id of the script to search in.query
- String to search for.caseSensitive
- If true, search is case sensitive.
OPTIONALisRegex
- If true, treats string parameter as regex.
OPTIONAL- Returns:
- An instance of
Script
<String,JsonObject
,Debugger.SearchMatch
[]>
This script may be executed, usingScript.exec()
, and afterwards, aPromise
<JsonObject,
will be returned.Debugger.SearchMatch
[]>
Finally, thePromise
may be awaited, usingPromise.await()
, and the returned result of this Browser Function may may be retrieved.
This Browser Function returns
)Debugger.SearchMatch
[] (result
List of search matches.
-
setAsyncCallStackDepth
public static Script<java.lang.String,JsonObject,Ret0> setAsyncCallStackDepth (int maxDepth)
Enables or disables async call stacks tracking.- Parameters:
maxDepth
- Maximum depth of async call stacks. Setting to0
will effectively disable collecting async call stacks (default).- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
setBlackboxPatterns
public static Script<java.lang.String,JsonObject,Ret0> setBlackboxPatterns (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.
EXPERIMENTAL- Parameters:
patterns
- Array of regexps that will be used to check script url for blackbox state.- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
setBlackboxedRanges
public static Script<java.lang.String,JsonObject,Ret0> setBlackboxedRanges (java.lang.String scriptId, Debugger.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.
EXPERIMENTAL- Parameters:
scriptId
- Id of the script.positions
- -- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
setBreakpoint
public static Script<java.lang.String,JsonObject,Ret2<java.lang.String,Debugger.Location>> setBreakpoint (Debugger.Location location, java.lang.String condition)
Sets JavaScript breakpoint at a given location.- Parameters:
location
- Location to set breakpoint in.condition
- Expression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true.
OPTIONAL- Returns:
- An instance of
Script
<String,JsonObject
,Ret2
>
ThisScript
may be executed (usingScript.exec()
), and aPromise
returned.
When thePromise
is awaited (usingPromise.await()
), theRet2
will subsequently be returned from that call.
The returned values are encapsulated in an instance ofRet2
Ret2.a: String (breakpointId)
Id of the created breakpoint for further reference.Ret2.b:
Debugger.Location
(actualLocation)
Location this breakpoint resolved into.
-
setInstrumentationBreakpoint
public static Script<java.lang.String,JsonObject,java.lang.String> setInstrumentationBreakpoint (java.lang.String instrumentation)
Sets instrumentation breakpoint.- Parameters:
instrumentation
- Instrumentation name.
Acceptable Values: ["beforeScriptExecution", "beforeScriptWithSourceMapExecution"]- Returns:
- An instance of
Script
<String,JsonObject
, String>
This script may be executed, usingScript.exec()
, and afterwards, aPromise
<JsonObject, String>
will be returned.
Finally, thePromise
may be awaited, usingPromise.await()
, and the returned result of this Browser Function may may be retrieved.
This Browser Function returnsString (breakpointId
)
Id of the created breakpoint for further reference.
-
setBreakpointByUrl
public static Script<java.lang.String,JsonObject,Ret2<java.lang.String,Debugger.Location[]>> setBreakpointByUrl (int lineNumber, java.lang.String url, java.lang.String urlRegex, java.lang.String scriptHash, java.lang.Integer columnNumber, 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 inlocations
property. Further matching script parsing will result in subsequentbreakpointResolved
events issued. This logical breakpoint will survive page reloads.- Parameters:
lineNumber
- Line number to set breakpoint at.url
- URL of the resources to set breakpoint on.
OPTIONALurlRegex
- Regex pattern for the URLs of the resources to set breakpoints on. Eitherurl
orurlRegex
must be specified.
OPTIONALscriptHash
- Script hash of the resources to set breakpoint on.
OPTIONALcolumnNumber
- Offset in the line to set breakpoint at.
OPTIONALcondition
- Expression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true.
OPTIONAL- Returns:
- An instance of
Script
<String,JsonObject
,Ret2
>
ThisScript
may be executed (usingScript.exec()
), and aPromise
returned.
When thePromise
is awaited (usingPromise.await()
), theRet2
will subsequently be returned from that call.
The returned values are encapsulated in an instance ofRet2
Ret2.a: String (breakpointId)
Id of the created breakpoint for further reference.Ret2.b:
Debugger.Location
[] (locations)
List of the locations this breakpoint resolved into upon addition.
-
setBreakpointOnFunctionCall
public static Script<java.lang.String,JsonObject,java.lang.String> setBreakpointOnFunctionCall (java.lang.String objectId, 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.
EXPERIMENTAL- Parameters:
objectId
- Function object id.condition
- Expression to use as a breakpoint condition. When specified, debugger will stop on the breakpoint if this expression evaluates to true.
OPTIONAL- Returns:
- An instance of
Script
<String,JsonObject
, String>
This script may be executed, usingScript.exec()
, and afterwards, aPromise
<JsonObject, String>
will be returned.
Finally, thePromise
may be awaited, usingPromise.await()
, and the returned result of this Browser Function may may be retrieved.
This Browser Function returnsString (breakpointId
)
Id of the created breakpoint for further reference.
-
setBreakpointsActive
public static Script<java.lang.String,JsonObject,Ret0> setBreakpointsActive (boolean active)
Activates / deactivates all breakpoints on the page.- Parameters:
active
- New value for breakpoints active state.- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
setPauseOnExceptions
public static Script<java.lang.String,JsonObject,Ret0> setPauseOnExceptions (java.lang.String state)
Defines pause on exceptions state. Can be set to stop on all exceptions, uncaught exceptions or no exceptions. Initial pause on exceptions state isnone
.- Parameters:
state
- Pause on exceptions mode.
Acceptable Values: ["none", "uncaught", "all"]- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
setReturnValue
public static Script<java.lang.String,JsonObject,Ret0> setReturnValue (RunTime.CallArgument newValue)
Changes return value in top frame. Available only at return break position.
EXPERIMENTAL- Parameters:
newValue
- New return value.- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
setScriptSource
public static Script<java.lang.String,JsonObject,Ret5<Debugger.CallFrame[],java.lang.Boolean,RunTime.StackTrace,RunTime.StackTraceId,RunTime.ExceptionDetails>> setScriptSource (java.lang.String scriptId, java.lang.String scriptSource, java.lang.Boolean dryRun)
Edits JavaScript source live.- Parameters:
scriptId
- Id of the script to edit.scriptSource
- New content of the script.dryRun
- If true the change will not actually be applied. Dry run may be used to get result description without actually modifying the code.
OPTIONAL- Returns:
- An instance of
Script
<String,JsonObject
,Ret5
>
ThisScript
may be executed (usingScript.exec()
), and aPromise
returned.
When thePromise
is awaited (usingPromise.await()
), theRet5
will subsequently be returned from that call.
The returned values are encapsulated in an instance ofRet5
Ret5.a:
Debugger.CallFrame
[] (callFrames)
New stack trace in case editing has happened while VM was stopped.Ret5.b: Boolean (stackChanged)
Whether current call stack was modified after applying the changes.Ret5.c:
RunTime.StackTrace
(asyncStackTrace)
Async stack trace, if any.Ret5.d:
RunTime.StackTraceId
(asyncStackTraceId)
Async stack trace, if any.Ret5.e:
RunTime.ExceptionDetails
(exceptionDetails)
Exception details if any.
-
setSkipAllPauses
public static Script<java.lang.String,JsonObject,Ret0> setSkipAllPauses (boolean skip)
Makes page not interrupt on any pauses (breakpoint, exception, dom exception etc).- Parameters:
skip
- New value for skip pauses state.- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
setVariableValue
public static Script<java.lang.String,JsonObject,Ret0> setVariableValue (int scopeNumber, java.lang.String variableName, RunTime.CallArgument newValue, java.lang.String callFrameId)
Changes value of variable in a callframe. Object-based scopes are not supported and must be mutated manually.- Parameters:
scopeNumber
- 0-based number of scope as was listed in scope chain. Only 'local', 'closure' and 'catch' scope types are allowed. Other scopes could be manipulated manually.variableName
- Variable name.newValue
- New variable value.callFrameId
- Id of callframe that holds variable.- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
stepInto
public static Script<java.lang.String,JsonObject,Ret0> stepInto (java.lang.Boolean breakOnAsyncCall, Debugger.LocationRange[] skipList)
Steps into the function call.- Parameters:
breakOnAsyncCall
- Debugger will pause on the execution of the first async task which was scheduled before next pause.
OPTIONAL
EXPERIMENTALskipList
- The skipList specifies location ranges that should be skipped on step into.
OPTIONAL
EXPERIMENTAL- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
stepOut
public static Script<java.lang.String,JsonObject,Ret0> stepOut()
Steps out of the function call.- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
stepOver
public static Script<java.lang.String,JsonObject,Ret0> stepOver (Debugger.LocationRange[] skipList)
Steps over the statement.- Parameters:
skipList
- The skipList specifies location ranges that should be skipped on step over.
OPTIONAL
EXPERIMENTAL- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
-