Class: Selenium::DevTools::V123::Debugger

Inherits:
Object
  • Object
show all
Defined in:
lib/selenium/devtools/v123/debugger.rb

Constant Summary collapse

EVENTS =
{
  breakpoint_resolved: 'breakpointResolved',
  paused: 'paused',
  resumed: 'resumed',
  script_failed_to_parse: 'scriptFailedToParse',
  script_parsed: 'scriptParsed',
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(devtools) ⇒ Debugger

Returns a new instance of Debugger.



33
34
35
# File 'lib/selenium/devtools/v123/debugger.rb', line 33

def initialize(devtools)
  @devtools = devtools
end

Instance Method Details

#continue_to_location(location:, target_call_frames: nil) ⇒ Object



42
43
44
45
46
# File 'lib/selenium/devtools/v123/debugger.rb', line 42

def continue_to_location(location:, target_call_frames: nil)
  @devtools.send_cmd('Debugger.continueToLocation',
                     location: location,
                     targetCallFrames: target_call_frames)
end

#disableObject



48
49
50
# File 'lib/selenium/devtools/v123/debugger.rb', line 48

def disable
  @devtools.send_cmd('Debugger.disable')
end

#disassemble_wasm_module(script_id:) ⇒ Object



82
83
84
85
# File 'lib/selenium/devtools/v123/debugger.rb', line 82

def disassemble_wasm_module(script_id:)
  @devtools.send_cmd('Debugger.disassembleWasmModule',
                     scriptId: script_id)
end

#enable(max_scripts_cache_size: nil) ⇒ Object



52
53
54
55
# File 'lib/selenium/devtools/v123/debugger.rb', line 52

def enable(max_scripts_cache_size: nil)
  @devtools.send_cmd('Debugger.enable',
                     maxScriptsCacheSize: max_scripts_cache_size)
end

#evaluate_on_call_frame(call_frame_id:, expression:, object_group: nil, include_command_line_api: nil, silent: nil, return_by_value: nil, generate_preview: nil, throw_on_side_effect: nil, timeout: nil) ⇒ Object



57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/selenium/devtools/v123/debugger.rb', line 57

def evaluate_on_call_frame(call_frame_id:, expression:, object_group: nil, include_command_line_api: nil, silent: nil, return_by_value: nil, generate_preview: nil, throw_on_side_effect: nil, timeout: nil)
  @devtools.send_cmd('Debugger.evaluateOnCallFrame',
                     callFrameId: call_frame_id,
                     expression: expression,
                     objectGroup: object_group,
                     includeCommandLineAPI: include_command_line_api,
                     silent: silent,
                     returnByValue: return_by_value,
                     generatePreview: generate_preview,
                     throwOnSideEffect: throw_on_side_effect,
                     timeout: timeout)
end

#get_possible_breakpoints(start:, _end: nil, restrict_to_function: nil) ⇒ Object



70
71
72
73
74
75
# File 'lib/selenium/devtools/v123/debugger.rb', line 70

def get_possible_breakpoints(start:, _end: nil, restrict_to_function: nil)
  @devtools.send_cmd('Debugger.getPossibleBreakpoints',
                     start: start,
                     end: _end,
                     restrictToFunction: restrict_to_function)
end

#get_script_source(script_id:) ⇒ Object



77
78
79
80
# File 'lib/selenium/devtools/v123/debugger.rb', line 77

def get_script_source(script_id:)
  @devtools.send_cmd('Debugger.getScriptSource',
                     scriptId: script_id)
end

#get_stack_trace(stack_trace_id:) ⇒ Object



97
98
99
100
# File 'lib/selenium/devtools/v123/debugger.rb', line 97

def get_stack_trace(stack_trace_id:)
  @devtools.send_cmd('Debugger.getStackTrace',
                     stackTraceId: stack_trace_id)
end

#get_wasm_bytecode(script_id:) ⇒ Object



92
93
94
95
# File 'lib/selenium/devtools/v123/debugger.rb', line 92

def get_wasm_bytecode(script_id:)
  @devtools.send_cmd('Debugger.getWasmBytecode',
                     scriptId: script_id)
end

#next_wasm_disassembly_chunk(stream_id:) ⇒ Object



87
88
89
90
# File 'lib/selenium/devtools/v123/debugger.rb', line 87

def next_wasm_disassembly_chunk(stream_id:)
  @devtools.send_cmd('Debugger.nextWasmDisassemblyChunk',
                     streamId: stream_id)
end

#on(event, &block) ⇒ Object



37
38
39
40
# File 'lib/selenium/devtools/v123/debugger.rb', line 37

def on(event, &block)
  event = EVENTS[event] if event.is_a?(Symbol)
  @devtools.callbacks["Debugger.#{event}"] << block
end

#pauseObject



102
103
104
# File 'lib/selenium/devtools/v123/debugger.rb', line 102

def pause
  @devtools.send_cmd('Debugger.pause')
end

#pause_on_async_call(parent_stack_trace_id:) ⇒ Object



106
107
108
109
# File 'lib/selenium/devtools/v123/debugger.rb', line 106

def pause_on_async_call(parent_stack_trace_id:)
  @devtools.send_cmd('Debugger.pauseOnAsyncCall',
                     parentStackTraceId: parent_stack_trace_id)
end

#remove_breakpoint(breakpoint_id:) ⇒ Object



111
112
113
114
# File 'lib/selenium/devtools/v123/debugger.rb', line 111

def remove_breakpoint(breakpoint_id:)
  @devtools.send_cmd('Debugger.removeBreakpoint',
                     breakpointId: breakpoint_id)
end

#restart_frame(call_frame_id:, mode: nil) ⇒ Object



116
117
118
119
120
# File 'lib/selenium/devtools/v123/debugger.rb', line 116

def restart_frame(call_frame_id:, mode: nil)
  @devtools.send_cmd('Debugger.restartFrame',
                     callFrameId: call_frame_id,
                     mode: mode)
end

#resume(terminate_on_resume: nil) ⇒ Object



122
123
124
125
# File 'lib/selenium/devtools/v123/debugger.rb', line 122

def resume(terminate_on_resume: nil)
  @devtools.send_cmd('Debugger.resume',
                     terminateOnResume: terminate_on_resume)
end

#search_in_content(script_id:, query:, case_sensitive: nil, is_regex: nil) ⇒ Object



127
128
129
130
131
132
133
# File 'lib/selenium/devtools/v123/debugger.rb', line 127

def search_in_content(script_id:, query:, case_sensitive: nil, is_regex: nil)
  @devtools.send_cmd('Debugger.searchInContent',
                     scriptId: script_id,
                     query: query,
                     caseSensitive: case_sensitive,
                     isRegex: is_regex)
end

#set_async_call_stack_depth(max_depth:) ⇒ Object



135
136
137
138
# File 'lib/selenium/devtools/v123/debugger.rb', line 135

def set_async_call_stack_depth(max_depth:)
  @devtools.send_cmd('Debugger.setAsyncCallStackDepth',
                     maxDepth: max_depth)
end

#set_blackbox_patterns(patterns:) ⇒ Object



140
141
142
143
# File 'lib/selenium/devtools/v123/debugger.rb', line 140

def set_blackbox_patterns(patterns:)
  @devtools.send_cmd('Debugger.setBlackboxPatterns',
                     patterns: patterns)
end

#set_blackboxed_ranges(script_id:, positions:) ⇒ Object



145
146
147
148
149
# File 'lib/selenium/devtools/v123/debugger.rb', line 145

def set_blackboxed_ranges(script_id:, positions:)
  @devtools.send_cmd('Debugger.setBlackboxedRanges',
                     scriptId: script_id,
                     positions: positions)
end

#set_breakpoint(location:, condition: nil) ⇒ Object



151
152
153
154
155
# File 'lib/selenium/devtools/v123/debugger.rb', line 151

def set_breakpoint(location:, condition: nil)
  @devtools.send_cmd('Debugger.setBreakpoint',
                     location: location,
                     condition: condition)
end

#set_breakpoint_by_url(line_number:, url: nil, url_regex: nil, script_hash: nil, column_number: nil, condition: nil) ⇒ Object



162
163
164
165
166
167
168
169
170
# File 'lib/selenium/devtools/v123/debugger.rb', line 162

def set_breakpoint_by_url(line_number:, url: nil, url_regex: nil, script_hash: nil, column_number: nil, condition: nil)
  @devtools.send_cmd('Debugger.setBreakpointByUrl',
                     lineNumber: line_number,
                     url: url,
                     urlRegex: url_regex,
                     scriptHash: script_hash,
                     columnNumber: column_number,
                     condition: condition)
end

#set_breakpoint_on_function_call(object_id:, condition: nil) ⇒ Object



172
173
174
175
176
# File 'lib/selenium/devtools/v123/debugger.rb', line 172

def set_breakpoint_on_function_call(object_id:, condition: nil)
  @devtools.send_cmd('Debugger.setBreakpointOnFunctionCall',
                     objectId: object_id,
                     condition: condition)
end

#set_breakpoints_active(active:) ⇒ Object



178
179
180
181
# File 'lib/selenium/devtools/v123/debugger.rb', line 178

def set_breakpoints_active(active:)
  @devtools.send_cmd('Debugger.setBreakpointsActive',
                     active: active)
end

#set_instrumentation_breakpoint(instrumentation:) ⇒ Object



157
158
159
160
# File 'lib/selenium/devtools/v123/debugger.rb', line 157

def set_instrumentation_breakpoint(instrumentation:)
  @devtools.send_cmd('Debugger.setInstrumentationBreakpoint',
                     instrumentation: instrumentation)
end

#set_pause_on_exceptions(state:) ⇒ Object



183
184
185
186
# File 'lib/selenium/devtools/v123/debugger.rb', line 183

def set_pause_on_exceptions(state:)
  @devtools.send_cmd('Debugger.setPauseOnExceptions',
                     state: state)
end

#set_return_value(new_value:) ⇒ Object



188
189
190
191
# File 'lib/selenium/devtools/v123/debugger.rb', line 188

def set_return_value(new_value:)
  @devtools.send_cmd('Debugger.setReturnValue',
                     newValue: new_value)
end

#set_script_source(script_id:, script_source:, dry_run: nil, allow_top_frame_editing: nil) ⇒ Object



193
194
195
196
197
198
199
# File 'lib/selenium/devtools/v123/debugger.rb', line 193

def set_script_source(script_id:, script_source:, dry_run: nil, allow_top_frame_editing: nil)
  @devtools.send_cmd('Debugger.setScriptSource',
                     scriptId: script_id,
                     scriptSource: script_source,
                     dryRun: dry_run,
                     allowTopFrameEditing: allow_top_frame_editing)
end

#set_skip_all_pauses(skip:) ⇒ Object



201
202
203
204
# File 'lib/selenium/devtools/v123/debugger.rb', line 201

def set_skip_all_pauses(skip:)
  @devtools.send_cmd('Debugger.setSkipAllPauses',
                     skip: skip)
end

#set_variable_value(scope_number:, variable_name:, new_value:, call_frame_id:) ⇒ Object



206
207
208
209
210
211
212
# File 'lib/selenium/devtools/v123/debugger.rb', line 206

def set_variable_value(scope_number:, variable_name:, new_value:, call_frame_id:)
  @devtools.send_cmd('Debugger.setVariableValue',
                     scopeNumber: scope_number,
                     variableName: variable_name,
                     newValue: new_value,
                     callFrameId: call_frame_id)
end

#step_into(break_on_async_call: nil, skip_list: nil) ⇒ Object



214
215
216
217
218
# File 'lib/selenium/devtools/v123/debugger.rb', line 214

def step_into(break_on_async_call: nil, skip_list: nil)
  @devtools.send_cmd('Debugger.stepInto',
                     breakOnAsyncCall: break_on_async_call,
                     skipList: skip_list)
end

#step_outObject



220
221
222
# File 'lib/selenium/devtools/v123/debugger.rb', line 220

def step_out
  @devtools.send_cmd('Debugger.stepOut')
end

#step_over(skip_list: nil) ⇒ Object



224
225
226
227
# File 'lib/selenium/devtools/v123/debugger.rb', line 224

def step_over(skip_list: nil)
  @devtools.send_cmd('Debugger.stepOver',
                     skipList: skip_list)
end