Class: Selenium::DevTools::V85::Runtime

Inherits:
Object
  • Object
show all
Defined in:
lib/selenium/devtools/v85/runtime.rb

Constant Summary collapse

EVENTS =
{
  binding_called: 'bindingCalled',
  console_api_called: 'consoleAPICalled',
  exception_revoked: 'exceptionRevoked',
  exception_thrown: 'exceptionThrown',
  execution_context_created: 'executionContextCreated',
  execution_context_destroyed: 'executionContextDestroyed',
  execution_contexts_cleared: 'executionContextsCleared',
  inspect_requested: 'inspectRequested',
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(devtools) ⇒ Runtime

Returns a new instance of Runtime.



36
37
38
# File 'lib/selenium/devtools/v85/runtime.rb', line 36

def initialize(devtools)
  @devtools = devtools
end

Instance Method Details

#add_binding(name:, execution_context_id: nil) ⇒ Object



176
177
178
179
180
# File 'lib/selenium/devtools/v85/runtime.rb', line 176

def add_binding(name:, execution_context_id: nil)
  @devtools.send_cmd('Runtime.addBinding',
                     name: name,
                     executionContextId: execution_context_id)
end

#await_promise(promise_object_id:, return_by_value: nil, generate_preview: nil) ⇒ Object



45
46
47
48
49
50
# File 'lib/selenium/devtools/v85/runtime.rb', line 45

def await_promise(promise_object_id:, return_by_value: nil, generate_preview: nil)
  @devtools.send_cmd('Runtime.awaitPromise',
                     promiseObjectId: promise_object_id,
                     returnByValue: return_by_value,
                     generatePreview: generate_preview)
end

#call_function_on(function_declaration:, object_id: nil, arguments: nil, silent: nil, return_by_value: nil, generate_preview: nil, user_gesture: nil, await_promise: nil, execution_context_id: nil, object_group: nil) ⇒ Object



52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/selenium/devtools/v85/runtime.rb', line 52

def call_function_on(function_declaration:, object_id: nil, arguments: nil, silent: nil, return_by_value: nil, generate_preview: nil, user_gesture: nil, await_promise: nil, execution_context_id: nil, object_group: nil)
  @devtools.send_cmd('Runtime.callFunctionOn',
                     functionDeclaration: function_declaration,
                     objectId: object_id,
                     arguments: arguments,
                     silent: silent,
                     returnByValue: return_by_value,
                     generatePreview: generate_preview,
                     userGesture: user_gesture,
                     awaitPromise: await_promise,
                     executionContextId: execution_context_id,
                     objectGroup: object_group)
end

#compile_script(expression:, source_url:, persist_script:, execution_context_id: nil) ⇒ Object



66
67
68
69
70
71
72
# File 'lib/selenium/devtools/v85/runtime.rb', line 66

def compile_script(expression:, source_url:, persist_script:, execution_context_id: nil)
  @devtools.send_cmd('Runtime.compileScript',
                     expression: expression,
                     sourceURL: source_url,
                     persistScript: persist_script,
                     executionContextId: execution_context_id)
end

#disableObject



74
75
76
# File 'lib/selenium/devtools/v85/runtime.rb', line 74

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

#discard_console_entriesObject



78
79
80
# File 'lib/selenium/devtools/v85/runtime.rb', line 78

def discard_console_entries
  @devtools.send_cmd('Runtime.discardConsoleEntries')
end

#enableObject



82
83
84
# File 'lib/selenium/devtools/v85/runtime.rb', line 82

def enable
  @devtools.send_cmd('Runtime.enable')
end

#evaluate(expression:, object_group: nil, include_command_line_api: nil, silent: nil, context_id: nil, return_by_value: nil, generate_preview: nil, user_gesture: nil, await_promise: nil, throw_on_side_effect: nil, timeout: nil, disable_breaks: nil, repl_mode: nil, allow_unsafe_eval_blocked_by_csp: nil) ⇒ Object



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/selenium/devtools/v85/runtime.rb', line 86

def evaluate(expression:, object_group: nil, include_command_line_api: nil, silent: nil, context_id: nil, return_by_value: nil, generate_preview: nil, user_gesture: nil, await_promise: nil, throw_on_side_effect: nil, timeout: nil, disable_breaks: nil, repl_mode: nil, allow_unsafe_eval_blocked_by_csp: nil)
  @devtools.send_cmd('Runtime.evaluate',
                     expression: expression,
                     objectGroup: object_group,
                     includeCommandLineAPI: include_command_line_api,
                     silent: silent,
                     contextId: context_id,
                     returnByValue: return_by_value,
                     generatePreview: generate_preview,
                     userGesture: user_gesture,
                     awaitPromise: await_promise,
                     throwOnSideEffect: throw_on_side_effect,
                     timeout: timeout,
                     disableBreaks: disable_breaks,
                     replMode: repl_mode,
                     allowUnsafeEvalBlockedByCSP: allow_unsafe_eval_blocked_by_csp)
end

#get_heap_usageObject



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

def get_heap_usage
  @devtools.send_cmd('Runtime.getHeapUsage')
end

#get_isolate_idObject



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

def get_isolate_id
  @devtools.send_cmd('Runtime.getIsolateId')
end

#get_properties(object_id:, own_properties: nil, accessor_properties_only: nil, generate_preview: nil) ⇒ Object



112
113
114
115
116
117
118
# File 'lib/selenium/devtools/v85/runtime.rb', line 112

def get_properties(object_id:, own_properties: nil, accessor_properties_only: nil, generate_preview: nil)
  @devtools.send_cmd('Runtime.getProperties',
                     objectId: object_id,
                     ownProperties: own_properties,
                     accessorPropertiesOnly: accessor_properties_only,
                     generatePreview: generate_preview)
end

#global_lexical_scope_names(execution_context_id: nil) ⇒ Object



120
121
122
123
# File 'lib/selenium/devtools/v85/runtime.rb', line 120

def global_lexical_scope_names(execution_context_id: nil)
  @devtools.send_cmd('Runtime.globalLexicalScopeNames',
                     executionContextId: execution_context_id)
end

#on(event, &block) ⇒ Object



40
41
42
43
# File 'lib/selenium/devtools/v85/runtime.rb', line 40

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

#query_objects(prototype_object_id:, object_group: nil) ⇒ Object



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

def query_objects(prototype_object_id:, object_group: nil)
  @devtools.send_cmd('Runtime.queryObjects',
                     prototypeObjectId: prototype_object_id,
                     objectGroup: object_group)
end

#release_object(object_id:) ⇒ Object



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

def release_object(object_id:)
  @devtools.send_cmd('Runtime.releaseObject',
                     objectId: object_id)
end

#release_object_group(object_group:) ⇒ Object



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

def release_object_group(object_group:)
  @devtools.send_cmd('Runtime.releaseObjectGroup',
                     objectGroup: object_group)
end

#remove_binding(name:) ⇒ Object



182
183
184
185
# File 'lib/selenium/devtools/v85/runtime.rb', line 182

def remove_binding(name:)
  @devtools.send_cmd('Runtime.removeBinding',
                     name: name)
end

#run_if_waiting_for_debuggerObject



141
142
143
# File 'lib/selenium/devtools/v85/runtime.rb', line 141

def run_if_waiting_for_debugger
  @devtools.send_cmd('Runtime.runIfWaitingForDebugger')
end

#run_script(script_id:, execution_context_id: nil, object_group: nil, silent: nil, include_command_line_api: nil, return_by_value: nil, generate_preview: nil, await_promise: nil) ⇒ Object



145
146
147
148
149
150
151
152
153
154
155
# File 'lib/selenium/devtools/v85/runtime.rb', line 145

def run_script(script_id:, execution_context_id: nil, object_group: nil, silent: nil, include_command_line_api: nil, return_by_value: nil, generate_preview: nil, await_promise: nil)
  @devtools.send_cmd('Runtime.runScript',
                     scriptId: script_id,
                     executionContextId: execution_context_id,
                     objectGroup: object_group,
                     silent: silent,
                     includeCommandLineAPI: include_command_line_api,
                     returnByValue: return_by_value,
                     generatePreview: generate_preview,
                     awaitPromise: await_promise)
end

#set_async_call_stack_depth(max_depth:) ⇒ Object



157
158
159
160
# File 'lib/selenium/devtools/v85/runtime.rb', line 157

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

#set_custom_object_formatter_enabled(enabled:) ⇒ Object



162
163
164
165
# File 'lib/selenium/devtools/v85/runtime.rb', line 162

def set_custom_object_formatter_enabled(enabled:)
  @devtools.send_cmd('Runtime.setCustomObjectFormatterEnabled',
                     enabled: enabled)
end

#set_max_call_stack_size_to_capture(size:) ⇒ Object



167
168
169
170
# File 'lib/selenium/devtools/v85/runtime.rb', line 167

def set_max_call_stack_size_to_capture(size:)
  @devtools.send_cmd('Runtime.setMaxCallStackSizeToCapture',
                     size: size)
end

#terminate_executionObject



172
173
174
# File 'lib/selenium/devtools/v85/runtime.rb', line 172

def terminate_execution
  @devtools.send_cmd('Runtime.terminateExecution')
end