Class: Selenium::DevTools::V85::Debugger

Inherits:
Object
  • Object
show all
Defined in:
lib/selenium/devtools/v85/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/v85/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/v85/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/v85/debugger.rb', line 48

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

#enable(max_scripts_cache_size: nil) ⇒ Object



52
53
54
55
# File 'lib/selenium/devtools/v85/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/v85/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

#execute_wasm_evaluator(call_frame_id:, evaluator:, timeout: nil) ⇒ Object



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

def execute_wasm_evaluator(call_frame_id:, evaluator:, timeout: nil)
  @devtools.send_cmd('Debugger.executeWasmEvaluator',
                     callFrameId: call_frame_id,
                     evaluator: evaluator,
                     timeout: timeout)
end

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



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

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



84
85
86
87
# File 'lib/selenium/devtools/v85/debugger.rb', line 84

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

#get_stack_trace(stack_trace_id:) ⇒ Object



94
95
96
97
# File 'lib/selenium/devtools/v85/debugger.rb', line 94

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

#get_wasm_bytecode(script_id:) ⇒ Object



89
90
91
92
# File 'lib/selenium/devtools/v85/debugger.rb', line 89

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

#on(event, &block) ⇒ Object



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

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

#pauseObject



99
100
101
# File 'lib/selenium/devtools/v85/debugger.rb', line 99

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

#pause_on_async_call(parent_stack_trace_id:) ⇒ Object



103
104
105
106
# File 'lib/selenium/devtools/v85/debugger.rb', line 103

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



108
109
110
111
# File 'lib/selenium/devtools/v85/debugger.rb', line 108

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

#restart_frame(call_frame_id:) ⇒ Object



113
114
115
116
# File 'lib/selenium/devtools/v85/debugger.rb', line 113

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

#resume(terminate_on_resume: nil) ⇒ Object



118
119
120
121
# File 'lib/selenium/devtools/v85/debugger.rb', line 118

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



123
124
125
126
127
128
129
# File 'lib/selenium/devtools/v85/debugger.rb', line 123

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



131
132
133
134
# File 'lib/selenium/devtools/v85/debugger.rb', line 131

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

#set_blackbox_patterns(patterns:) ⇒ Object



136
137
138
139
# File 'lib/selenium/devtools/v85/debugger.rb', line 136

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

#set_blackboxed_ranges(script_id:, positions:) ⇒ Object



141
142
143
144
145
# File 'lib/selenium/devtools/v85/debugger.rb', line 141

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

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



147
148
149
150
151
# File 'lib/selenium/devtools/v85/debugger.rb', line 147

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



158
159
160
161
162
163
164
165
166
# File 'lib/selenium/devtools/v85/debugger.rb', line 158

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



168
169
170
171
172
# File 'lib/selenium/devtools/v85/debugger.rb', line 168

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



174
175
176
177
# File 'lib/selenium/devtools/v85/debugger.rb', line 174

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

#set_instrumentation_breakpoint(instrumentation:) ⇒ Object



153
154
155
156
# File 'lib/selenium/devtools/v85/debugger.rb', line 153

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

#set_pause_on_exceptions(state:) ⇒ Object



179
180
181
182
# File 'lib/selenium/devtools/v85/debugger.rb', line 179

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

#set_return_value(new_value:) ⇒ Object



184
185
186
187
# File 'lib/selenium/devtools/v85/debugger.rb', line 184

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) ⇒ Object



189
190
191
192
193
194
# File 'lib/selenium/devtools/v85/debugger.rb', line 189

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

#set_skip_all_pauses(skip:) ⇒ Object



196
197
198
199
# File 'lib/selenium/devtools/v85/debugger.rb', line 196

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



201
202
203
204
205
206
207
# File 'lib/selenium/devtools/v85/debugger.rb', line 201

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) ⇒ Object



209
210
211
212
# File 'lib/selenium/devtools/v85/debugger.rb', line 209

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

#step_outObject



214
215
216
# File 'lib/selenium/devtools/v85/debugger.rb', line 214

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

#step_overObject



218
219
220
# File 'lib/selenium/devtools/v85/debugger.rb', line 218

def step_over
  @devtools.send_cmd('Debugger.stepOver')
end