Package Torello.Browser.JavaScriptAPI
Class Debugger
- java.lang.Object
-
- Torello.Browser.JavaScriptAPI.Debugger
-
public class Debugger extends java.lang.Object
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.
These files were converted into this Java-Browser (CDP) Library. The intention is to have them function in a similar fasion to the Node.js Tool known as 'Puppeteer', Microsoft's 'Playwright' and of course the Main-Stay 'Selenium.' The Java-HTML JAR Library merely implements the Java Types & Commands defined by Google's DevTools Protocol.
🧠 View the Google CDP API:
Debugger domain exposes JavaScript debugging capabilities. It allows setting and removing breakpoints, stepping through execution, exploring stack traces, etc.
The top-level description and explanation for this class (this comment, at the top this Java-Doc Page) is repeated, verbatim, across all of the domain classes which comprise Google's CDP API.This class is intended to be used with a Browser Instance
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. Google-Corporation is the developer of this API, but any browser which accepts a Remote Debug Port Connection over Web-Sockets.
Google-Chrome was used during the development process of the classes in this particular package. Lately, it has been asserted Microsoft has switched to using the Chrome Browser-Engine for its Microsoft Edge Internal Code-Base. Therefore, there may some functionality available when running the methods in this class with Microsoft-Edge.
Check whether the your Web-Browser will allow itself to be driven by theWeb-Socket RDP-Port 9223. See the examples available in packageTorello.Browserto undertand how to build aPageConnandBrowserConnWeb-Socket Connection, and how to build aWebSocketSenderinstance in order to execute the methods in this class.
Web-Socket & JSON 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 Connection
- Receive BOTH that Command-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 a User-Registered, Event-Listener (Events) or a Promise Object (Command Responses / Results)
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".
Asking Chat-GPT for Help:
The LLM otherwise known as "Chat-GPT" does, indeed, have an expert level of knowledge about the "Remote DevTools Protocol". The API that theChrome DevTools Protocl (CDP)exports is extremely well understood by the LLM, and generally I have found that Chat-GPT understands (by 2 or 3 orders of magnitude) better what my Auto-Generated JSON-Wrappers can do in controlling a Web-Browser than I could ever possibly hope to understand.
Though not available today, there will soon be an automatically downloadable Token-Stream (AI Embeddings) BUTTON available on my Java-Doc Pages that should hopefully make it extremely easy to post my code-base, RAG Style, to Chat-GPT and other LLM's when 'interogating' them. Presently, because my "Get Token Stream Button" does not exist yet on any of my pages, what you can do is copy-and-paste any Method-Signature from any one of these pages and then ask Chat-GPT to explain what that Browser or Java-Script Function is actually doing. It is very likely to give you some pretty neat answers.
I have found that every single one of the Domains, Types & Events which are offered by the CDP Protocol (though not documented very well by Google), are perfectly understood by the A.I. LLM - literally to the point where it does know (much better than I ever could) what my own code base actually does!
Try it out, it's a lot of fun. Note that this package and these classes were originally developed solely to be able to execute the Java-Script that a browser executes when visiting a Web-Site. Complete HTML-Page Content can be scraped (using the HTML Data-Scraping Tools in Java-HTML) off of Web-Sites that have dynamic / Java-Script Generated Content.
Conspicuous Boxed-Types Usage:
You may notice that there are many methods that have parameters which accept, for instance, anInteger, instead of a primitiveint. Just to remind the readiner, in Java Programs aBoxed Typeis a standard Java-Primitive which has been converted into an Object-Reference. The use of Boxed-Types in this code base is an easy-and-fast-way to allow for the concept of "Optional Parameters" or "Optional Field Value."
Whenever you see a method that accepts anInteger, the reason for this Parameter-Type choice is actually to allow a user to pass 'null' to it. This is a simple way to ELIDE passing any value at all to parameters which Google-Chrome would otherwise assert are "Optional." Whenever you pass 'null' to a Boxed-Types in this class, the Json-Processor will simply eliminate that Object-Property from the command altogether; and the browser will simply not receive any value for that parameter when that command is invoked.
The Java Language Specification does not have an easy or well defined means of accepting optional method parameters; so Boxed-Types and 'null' are utilized here. Note that 'null' may be passed to any Command Method-Parameter that is listed asOptionalon the Java-Doc Page description for that parameter.
Hi-Lited Source-Code:This File's Source Code:
- View Here: Torello/Browser/JavaScriptAPI/Debugger.java
- Open New Browser-Tab: Torello/Browser/JavaScriptAPI/Debugger.java
File Size: 118,773 Bytes Line Count: 2,836 '\n' Characters Found
Helper: Command Invocation Helpers
- View Here: Debugger$$Commands.java
- Open New Browser-Tab: Debugger$$Commands.java
File Size: 10,277 Bytes Line Count: 226 '\n' Characters Found
Stateless Class:This class neither contains any program-state, nor can it be instantiated. The@StaticFunctionalAnnotation may also be called 'The Spaghetti Report'.Static-Functionalclasses are, essentially, C-Styled Files, without any constructors or non-static member fields. It is a concept very similar to the Java-Bean's@StatelessAnnotation.
- 1 Constructor(s), 1 declared private, zero-argument constructor
- 35 Method(s), 35 declared static
- 4 Field(s), 4 declared static, 4 declared final
-
-
Nested Class Summary
Type Nested Classes: Types / Classes that Are Used & Exported by this Domain Modifier and Type Class Description static classDebugger.BreakLocation[No Description Provided by Google]static classDebugger.CallFrameJavaScript call frame.static classDebugger.DebugSymbolsDebug symbols available for a wasm script.static classDebugger.LocationLocation in the source code.static classDebugger.LocationRangeLocation range within one script.static classDebugger.ResolvedBreakpoint[No Description Provided by Google]static classDebugger.ScopeScope description.static classDebugger.ScriptPositionLocation in the source code.static classDebugger.SearchMatchSearch match for resource.static classDebugger.WasmDisassemblyChunk[No Description Provided by Google]Event Nested Classes: Browser Events, as Java Inner Classes, Which are Fired by this Domain Modifier and Type Class Description static classDebugger.breakpointResolvedFired when breakpoint is resolved to an actual script and location.static classDebugger.pausedFired when the virtual machine stopped on breakpoint or exception or any other stop criteria.static classDebugger.scriptFailedToParseFired when virtual machine fails to parse the script.static classDebugger.scriptParsedFired when virtual machine parses script.Command-Returns Nested Classes: Domain-Commands with Multiple Return-Values, and a Dedicated Inner-Class Modifier and Type Class Description static classDebugger.disassembleWasmModule$$RET[No Description Provided by Google]static classDebugger.evaluateOnCallFrame$$RETEvaluates expression on a given call frame.static classDebugger.getScriptSource$$RETReturns source for the script with given id.static classDebugger.restartFrame$$RETRestarts particular call frame from the beginning.static classDebugger.setBreakpoint$$RETSets JavaScript breakpoint at a given location.static classDebugger.setBreakpointByUrl$$RETSets JavaScript breakpoint at given location specified either by URL or URL regex.static classDebugger.setScriptSource$$RETEdits JavaScript source live.
-
Field Summary
Enumerated Strings: Like Java 'enum' Types, but Converted to Read-Only String-Lists Modifier and Type Field Description static ReadOnlyList<String>ScriptLanguageEnum of possible script languages.Eliminated Types: Removed CDP Types which Have Been Re-Mapped to Basic Java String Constants Modifier and Type Field Description static StringBreakpointIdBreakpoint identifier.static StringCallFrameIdCall frame identifier.Marker Events: Events without any Fields or Properties Modifier and Type Field Description static StringresumedFired when the virtual machine resumed execution.
-
Method Summary
Debugger Domain Commands Script Returns Modifier and Type Method Voidstatic Script<>continueToLocation(Debugger.Location location, String targetCallFrames)
Continues execution until specific location is reached.Voidstatic Script<>disable()
Disables debugger for given page.Debugger.disassembleWasmModule$$RETstatic Script<>disassembleWasmModule(String scriptId)
[No Description Provided by Google]Stringstatic Script<>enable(Number maxScriptsCacheSize)
Enables debugger for the given page.Debugger.evaluateOnCallFrame$$RETstatic 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.Debugger.getScriptSource$$RETstatic Script<>getScriptSource(String scriptId)
Returns source for the script with given id.RunTime.StackTracestatic Script<>getStackTrace(RunTime.StackTraceId stackTraceId)
Returns stack trace with givenstackTraceId.Stringstatic Script<>getWasmBytecode(String scriptId)
This command is deprecated.Debugger.WasmDisassemblyChunkstatic Script<>nextWasmDisassemblyChunk(String streamId)
Disassemble the next chunk of lines for the module corresponding to the stream.Voidstatic Script<>pause()
Stops on the next JavaScript statement.Voidstatic Script<>pauseOnAsyncCall(RunTime.StackTraceId parentStackTraceId)
[No Description Provided by Google]Voidstatic Script<>removeBreakpoint(String breakpointId)
Removes JavaScript breakpoint.Debugger.restartFrame$$RETstatic Script<>restartFrame(String callFrameId, String mode)
Restarts particular call frame from the beginning.Voidstatic 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.Voidstatic Script<>setAsyncCallStackDepth(int maxDepth)
Enables or disables async call stacks tracking.Voidstatic Script<>setBlackboxedRanges(String scriptId, Debugger.ScriptPosition[] positions)
Makes backend skip steps in the script in blackboxed ranges.Voidstatic Script<>setBlackboxExecutionContexts(String[] uniqueIds)
Replace previous blackbox execution contexts with passed ones.Voidstatic Script<>setBlackboxPatterns(String[] patterns, Boolean skipAnonymous)
Replace previous blackbox patterns with passed ones.Debugger.setBreakpoint$$RETstatic Script<>setBreakpoint(Debugger.Location location, String condition)
Sets JavaScript breakpoint at a given location.Debugger.setBreakpointByUrl$$RETstatic 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.Stringstatic Script<>setBreakpointOnFunctionCall(String objectId, String condition)
Sets JavaScript breakpoint before each call to the given function.Voidstatic Script<>setBreakpointsActive(boolean active)
Activates / deactivates all breakpoints on the page.Stringstatic Script<>setInstrumentationBreakpoint(String instrumentation)
Sets instrumentation breakpoint.Voidstatic Script<>setPauseOnExceptions(String state)
Defines pause on exceptions state.Voidstatic Script<>setReturnValue(RunTime.CallArgument newValue)
Changes return value in top frame.Debugger.setScriptSource$$RETstatic Script<>setScriptSource(String scriptId, String scriptSource, Boolean dryRun, Boolean allowTopFrameEditing)
Edits JavaScript source live.Voidstatic Script<>setSkipAllPauses(boolean skip)
Makes page not interrupt on any pauses (breakpoint, exception, dom exception etc).Voidstatic Script<>setVariableValue(int scopeNumber, String variableName, RunTime.CallArgument newValue, String callFrameId)
Changes value of variable in a callframe.Voidstatic Script<>stepInto(Boolean breakOnAsyncCall, Debugger.LocationRange[] skipList)
Steps into the function call.Voidstatic Script<>stepOut()
Steps out of the function call.Voidstatic Script<>stepOver(Debugger.LocationRange[] skipList)
Steps over the statement.Debugger Domain CommandBuilder Methods Modifier and Type Method Description static CommandBuilder
<Debugger.evaluateOnCallFrame$$RET>evaluateOnCallFrame()Creates a buider for conveniently assigning parameters to this method.static CommandBuilder
<Debugger.setBreakpointByUrl$$RET>setBreakpointByUrl()Creates a buider for conveniently assigning parameters to this method.
-
-
-
Field Detail
-
BreakpointId
public static final java.lang.String BreakpointId
Breakpoint identifier.
The TypeBreakpointIdhas been eliminated, because it is a direct mapping to a basic Java-Type; it has no additional fields, or other distinguishing properties. Instead, this CDP defined type has been relegated to a simpleStringConstant, for documentation & reference purposes only.
The code which is generated which employs this type replaces its use with the Standard Java-Type:String
Eliminated Type- See Also:
- Constant Field Values
-
CallFrameId
public static final java.lang.String CallFrameId
Call frame identifier.
The TypeCallFrameIdhas been eliminated, because it is a direct mapping to a basic Java-Type; it has no additional fields, or other distinguishing properties. Instead, this CDP defined type has been relegated to a simpleStringConstant, for documentation & reference purposes only.
The code which is generated which employs this type replaces its use with the Standard Java-Type:String
Eliminated Type- See Also:
- Constant Field Values
-
resumed
public static final java.lang.String resumed
Fired when the virtual machine resumed execution.
This is Marker-Event. Marker-Event's are events that do not possess any data or fields at all. When such events are fired by the browser, the Web-Socket sends nothing more than the name of the event in the packet. The Java-HTML CDP Implementation (this library) has not actually created a dedicated Java Event-Type for this Browser Event.
This specificstaticfield is actually just declared aString.resumedhas not been 'reified' into an actual nested / inner class of its own, at all.
Eliminated Event Type- See Also:
- Constant Field Values
-
ScriptLanguage
public static final ReadOnlyList<java.lang.String> ScriptLanguage
Enum of possible script languages.
String-Enumeration Type
-
-
Method Detail
-
continueToLocation
public static Script<java.lang.Void> 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<Void>
ThisScriptinstance 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<Void>to ensure that the Browser Function has run to completion.
-
disable
-
disassembleWasmModule
public static Script<Debugger.disassembleWasmModule$$RET> disassembleWasmModule (java.lang.String scriptId)
[No Description Provided by Google]
EXPERIMENTAL- Parameters:
scriptId- Id of the script to disassemble- Returns:
- An instance of
Script<Debugger.disassembleWasmModule$$RET>
This script may be executed, usingScript.exec, and afterwards, aPromise<will be returnedDebugger.disassembleWasmModule$$RET>
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.This Browser Function'sPromisereturns:Debugger.disassembleWasmModule$$RETA dedicated return type implies that the browser may return more than 1 datum
-
enable
public static Script<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.
OPTIONALEXPERIMENTAL- Returns:
- An instance of
Script<String>
This script may be executed, usingScript.exec, and afterwards, aPromise<String>will be returned
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.This Browser Function'sPromisereturns:String (debuggerId)
Unique identifier of the debugger.
-
evaluateOnCallFrame
public static Script<Debugger.evaluateOnCallFrame$$RET> 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.👍 Because of the sheer number of input parameters to this method, there is a aCommandBuildervariant to this method which may be invoked instead.
Please View:evaluateOnCallFrame()- 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. OverridessetPauseOnExceptionstate.
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.
OPTIONALEXPERIMENTALthrowOnSideEffect- Whether to throw an exception if side effect cannot be ruled out during evaluation.
OPTIONALtimeout- Terminate execution after timing out (number of milliseconds).
OPTIONALEXPERIMENTAL- Returns:
- An instance of
Script<Debugger.evaluateOnCallFrame$$RET>
This script may be executed, usingScript.exec, and afterwards, aPromise<will be returnedDebugger.evaluateOnCallFrame$$RET>
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.This Browser Function'sPromisereturns:Debugger.evaluateOnCallFrame$$RETA dedicated return type implies that the browser may return more than 1 datum
-
getPossibleBreakpoints
public static Script<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<Debugger.BreakLocation[]>
This script may be executed, usingScript.exec, and afterwards, aPromise<will be returnedDebugger.BreakLocation[]>
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.This Browser Function'sPromisereturns:Debugger.BreakLocation[] (locations)
List of the possible breakpoint locations.
-
getScriptSource
public static Script<Debugger.getScriptSource$$RET> 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<Debugger.getScriptSource$$RET>
This script may be executed, usingScript.exec, and afterwards, aPromise<will be returnedDebugger.getScriptSource$$RET>
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.This Browser Function'sPromisereturns:Debugger.getScriptSource$$RETA dedicated return type implies that the browser may return more than 1 datum
-
getStackTrace
public static Script<RunTime.StackTrace> getStackTrace (RunTime.StackTraceId stackTraceId)
Returns stack trace with givenstackTraceId.
EXPERIMENTAL- Parameters:
stackTraceId- -- Returns:
- An instance of
Script<RunTime.StackTrace>
This script may be executed, usingScript.exec, and afterwards, aPromise<will be returnedRunTime.StackTrace>
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.This Browser Function'sPromisereturns:RunTime.StackTrace(stackTrace)
-
getWasmBytecode
public static Script<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>
This script may be executed, usingScript.exec, and afterwards, aPromise<String>will be returned
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.This Browser Function'sPromisereturns:String (bytecode)
Script source. (Encoded as a base64 string when passed over JSON)
-
nextWasmDisassemblyChunk
public static Script<Debugger.WasmDisassemblyChunk> nextWasmDisassemblyChunk (java.lang.String streamId)
Disassemble the next chunk of lines for the module corresponding to the stream. If disassembly is complete, this API will invalidate the streamId and return an empty chunk. Any subsequent calls for the now invalid stream will return errors.
EXPERIMENTAL- Parameters:
streamId- -- Returns:
- An instance of
Script<Debugger.WasmDisassemblyChunk>
This script may be executed, usingScript.exec, and afterwards, aPromise<will be returnedDebugger.WasmDisassemblyChunk>
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.This Browser Function'sPromisereturns:Debugger.WasmDisassemblyChunk(chunk)
The next chunk of disassembly.
-
pause
-
pauseOnAsyncCall
public static Script<java.lang.Void> pauseOnAsyncCall (RunTime.StackTraceId parentStackTraceId)
[No Description Provided by Google]
EXPERIMENTALDEPRECATED- Parameters:
parentStackTraceId- Debugger will pause when async call with given stack trace is started.- Returns:
- An instance of
Script<Void>
ThisScriptinstance 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<Void>to ensure that the Browser Function has run to completion.
-
removeBreakpoint
public static Script<java.lang.Void> removeBreakpoint (java.lang.String breakpointId)
Removes JavaScript breakpoint.- Parameters:
breakpointId- -- Returns:
- An instance of
Script<Void>
ThisScriptinstance 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<Void>to ensure that the Browser Function has run to completion.
-
restartFrame
public static Script<Debugger.restartFrame$$RET> restartFrame (java.lang.String callFrameId, java.lang.String mode)
Restarts particular call frame from the beginning. The old, deprecated behavior ofrestartFrameis to stay paused and allow further CDP commands after a restart was scheduled. This can cause problems with restarting, so we now continue execution immediatly after it has been scheduled until we reach the beginning of the restarted frame. To stay back-wards compatible,restartFramenow expects amodeparameter to be present. If themodeparameter is missing,restartFrameerrors out. The various return values are deprecated andcallFramesis always empty. Use the call frames from theDebugger#pausedevents instead, that fires once V8 pauses at the beginning of the restarted function.- Parameters:
callFrameId- Call frame identifier to evaluate on.mode- Themodeparameter must be present and set to 'StepInto', otherwiserestartFramewill error out.
Acceptable Values: ["StepInto"]
OPTIONALEXPERIMENTAL- Returns:
- An instance of
Script<Debugger.restartFrame$$RET>
This script may be executed, usingScript.exec, and afterwards, aPromise<will be returnedDebugger.restartFrame$$RET>
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.This Browser Function'sPromisereturns:Debugger.restartFrame$$RETA dedicated return type implies that the browser may return more than 1 datum
-
resume
public static Script<java.lang.Void> 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<Void>
ThisScriptinstance 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<Void>to ensure that the Browser Function has run to completion.
-
searchInContent
public static Script<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<Debugger.SearchMatch[]>
This script may be executed, usingScript.exec, and afterwards, aPromise<will be returnedDebugger.SearchMatch[]>
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.
-
setAsyncCallStackDepth
public static Script<java.lang.Void> setAsyncCallStackDepth(int maxDepth)
Enables or disables async call stacks tracking.- Parameters:
maxDepth- Maximum depth of async call stacks. Setting to0will effectively disable collecting async call stacks (default).- Returns:
- An instance of
Script<Void>
ThisScriptinstance 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<Void>to ensure that the Browser Function has run to completion.
-
setBlackboxExecutionContexts
public static Script<java.lang.Void> setBlackboxExecutionContexts (java.lang.String[] uniqueIds)
Replace previous blackbox execution contexts with passed ones. Forces backend to skip stepping/pausing in scripts in these execution contexts. VM will try to leave blackboxed script by performing 'step in' several times, finally resorting to 'step out' if unsuccessful.
EXPERIMENTAL- Parameters:
uniqueIds- Array of execution context unique ids for the debugger to ignore.- Returns:
- An instance of
Script<Void>
ThisScriptinstance 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<Void>to ensure that the Browser Function has run to completion.
-
setBlackboxPatterns
public static Script<java.lang.Void> setBlackboxPatterns (java.lang.String[] patterns, java.lang.Boolean skipAnonymous)
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.skipAnonymous- If true, also ignore scripts with no source url.
OPTIONAL- Returns:
- An instance of
Script<Void>
ThisScriptinstance 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<Void>to ensure that the Browser Function has run to completion.
-
setBlackboxedRanges
public static Script<java.lang.Void> 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<Void>
ThisScriptinstance 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<Void>to ensure that the Browser Function has run to completion.
-
setBreakpoint
public static Script<Debugger.setBreakpoint$$RET> 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<Debugger.setBreakpoint$$RET>
This script may be executed, usingScript.exec, and afterwards, aPromise<will be returnedDebugger.setBreakpoint$$RET>
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.This Browser Function'sPromisereturns:Debugger.setBreakpoint$$RETA dedicated return type implies that the browser may return more than 1 datum
-
setBreakpointByUrl
public static Script<Debugger.setBreakpointByUrl$$RET> 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 inlocationsproperty. Further matching script parsing will result in subsequentbreakpointResolvedevents issued. This logical breakpoint will survive page reloads.👍 Because of the sheer number of input parameters to this method, there is a aCommandBuildervariant to this method which may be invoked instead.
Please View:setBreakpointByUrl()- 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. EitherurlorurlRegexmust 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<Debugger.setBreakpointByUrl$$RET>
This script may be executed, usingScript.exec, and afterwards, aPromise<will be returnedDebugger.setBreakpointByUrl$$RET>
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.This Browser Function'sPromisereturns:Debugger.setBreakpointByUrl$$RETA dedicated return type implies that the browser may return more than 1 datum
-
setBreakpointOnFunctionCall
public static Script<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>
This script may be executed, usingScript.exec, and afterwards, aPromise<String>will be returned
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.This Browser Function'sPromisereturns:String (breakpointId)
Id of the created breakpoint for further reference.
-
setBreakpointsActive
public static Script<java.lang.Void> setBreakpointsActive(boolean active)
Activates / deactivates all breakpoints on the page.- Parameters:
active- New value for breakpoints active state.- Returns:
- An instance of
Script<Void>
ThisScriptinstance 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<Void>to ensure that the Browser Function has run to completion.
-
setInstrumentationBreakpoint
public static Script<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>
This script may be executed, usingScript.exec, and afterwards, aPromise<String>will be returned
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.This Browser Function'sPromisereturns:String (breakpointId)
Id of the created breakpoint for further reference.
-
setPauseOnExceptions
public static Script<java.lang.Void> setPauseOnExceptions (java.lang.String state)
Defines pause on exceptions state. Can be set to stop on all exceptions, uncaught exceptions, or caught exceptions, no exceptions. Initial pause on exceptions state isnone.- Parameters:
state- Pause on exceptions mode.
Acceptable Values: ["all", "caught", "none", "uncaught"]- Returns:
- An instance of
Script<Void>
ThisScriptinstance 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<Void>to ensure that the Browser Function has run to completion.
-
setReturnValue
public static Script<java.lang.Void> 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<Void>
ThisScriptinstance 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<Void>to ensure that the Browser Function has run to completion.
-
setScriptSource
public static Script<Debugger.setScriptSource$$RET> setScriptSource (java.lang.String scriptId, java.lang.String scriptSource, java.lang.Boolean dryRun, java.lang.Boolean allowTopFrameEditing)
Edits JavaScript source live. In general, functions that are currently on the stack can not be edited with a single exception: If the edited function is the top-most stack frame and that is the only activation of that function on the stack. In this case the live edit will be successful and aDebugger.restartFramefor the top-most function is automatically triggered.- 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.
OPTIONALallowTopFrameEditing- If true, thenscriptSourceis allowed to change the function on top of the stack as long as the top-most stack frame is the only activation of that function.
OPTIONALEXPERIMENTAL- Returns:
- An instance of
Script<Debugger.setScriptSource$$RET>
This script may be executed, usingScript.exec, and afterwards, aPromise<will be returnedDebugger.setScriptSource$$RET>
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.This Browser Function'sPromisereturns:Debugger.setScriptSource$$RETA dedicated return type implies that the browser may return more than 1 datum
-
setSkipAllPauses
public static Script<java.lang.Void> 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<Void>
ThisScriptinstance 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<Void>to ensure that the Browser Function has run to completion.
-
setVariableValue
public static Script<java.lang.Void> 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<Void>
ThisScriptinstance 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<Void>to ensure that the Browser Function has run to completion.
-
stepInto
public static Script<java.lang.Void> 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.
OPTIONALEXPERIMENTALskipList- The skipList specifies location ranges that should be skipped on step into.
OPTIONALEXPERIMENTAL- Returns:
- An instance of
Script<Void>
ThisScriptinstance 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<Void>to ensure that the Browser Function has run to completion.
-
stepOut
-
stepOver
public static Script<java.lang.Void> stepOver (Debugger.LocationRange[] skipList)
Steps over the statement.- Parameters:
skipList- The skipList specifies location ranges that should be skipped on step over.
OPTIONALEXPERIMENTAL- Returns:
- An instance of
Script<Void>
ThisScriptinstance 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<Void>to ensure that the Browser Function has run to completion.
-
evaluateOnCallFrame
public static CommandBuilder<Debugger.evaluateOnCallFrame$$RET> evaluateOnCallFrame ()
Creates a buider for conveniently assigning parameters to this method.Note that the original method expects 9 parameters, and can be cumbersome.- Returns:
CommandBuilderinstance, for assigning parameter values, one by one.- See Also:
evaluateOnCallFrame(java.lang.String, java.lang.String, java.lang.String, java.lang.Boolean, java.lang.Boolean, java.lang.Boolean, java.lang.Boolean, java.lang.Boolean, java.lang.Number)
-
setBreakpointByUrl
public static CommandBuilder<Debugger.setBreakpointByUrl$$RET> setBreakpointByUrl ()
Creates a buider for conveniently assigning parameters to this method.Note that the original method expects 6 parameters, and can be cumbersome.- Returns:
CommandBuilderinstance, for assigning parameter values, one by one.- See Also:
setBreakpointByUrl(int, java.lang.String, java.lang.String, java.lang.String, java.lang.Integer, java.lang.String)
-
-