Class: Selenium::DevTools::V128::Runtime
- Inherits:
-
Object
- Object
- Selenium::DevTools::V128::Runtime
- Defined in:
- lib/selenium/devtools/v128/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
- #add_binding(name:, execution_context_id: nil, execution_context_name: nil) ⇒ Object
- #await_promise(promise_object_id:, return_by_value: nil, generate_preview: nil) ⇒ Object
- #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, throw_on_side_effect: nil, unique_context_id: nil, serialization_options: nil) ⇒ Object
- #compile_script(expression:, source_url:, persist_script:, execution_context_id: nil) ⇒ Object
- #disable ⇒ Object
- #discard_console_entries ⇒ Object
- #enable ⇒ Object
- #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, unique_context_id: nil, serialization_options: nil) ⇒ Object
- #get_exception_details(error_object_id:) ⇒ Object
- #get_heap_usage ⇒ Object
- #get_isolate_id ⇒ Object
- #get_properties(object_id:, own_properties: nil, accessor_properties_only: nil, generate_preview: nil, non_indexed_properties_only: nil) ⇒ Object
- #global_lexical_scope_names(execution_context_id: nil) ⇒ Object
-
#initialize(devtools) ⇒ Runtime
constructor
A new instance of Runtime.
- #on(event, &block) ⇒ Object
- #query_objects(prototype_object_id:, object_group: nil) ⇒ Object
- #release_object(object_id:) ⇒ Object
- #release_object_group(object_group:) ⇒ Object
- #remove_binding(name:) ⇒ Object
- #run_if_waiting_for_debugger ⇒ Object
- #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
- #set_async_call_stack_depth(max_depth:) ⇒ Object
- #set_custom_object_formatter_enabled(enabled:) ⇒ Object
- #set_max_call_stack_size_to_capture(size:) ⇒ Object
- #terminate_execution ⇒ Object
Constructor Details
#initialize(devtools) ⇒ Runtime
Returns a new instance of Runtime.
36 37 38 |
# File 'lib/selenium/devtools/v128/runtime.rb', line 36 def initialize(devtools) @devtools = devtools end |
Instance Method Details
#add_binding(name:, execution_context_id: nil, execution_context_name: nil) ⇒ Object
182 183 184 185 186 187 |
# File 'lib/selenium/devtools/v128/runtime.rb', line 182 def add_binding(name:, execution_context_id: nil, execution_context_name: nil) @devtools.send_cmd('Runtime.addBinding', name: name, executionContextId: execution_context_id, executionContextName: execution_context_name) end |
#await_promise(promise_object_id:, return_by_value: nil, generate_preview: nil) ⇒ Object
45 46 47 48 49 50 |
# File 'lib/selenium/devtools/v128/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, throw_on_side_effect: nil, unique_context_id: nil, serialization_options: nil) ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/selenium/devtools/v128/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, throw_on_side_effect: nil, unique_context_id: nil, serialization_options: 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, throwOnSideEffect: throw_on_side_effect, uniqueContextId: unique_context_id, serializationOptions: ) end |
#compile_script(expression:, source_url:, persist_script:, execution_context_id: nil) ⇒ Object
69 70 71 72 73 74 75 |
# File 'lib/selenium/devtools/v128/runtime.rb', line 69 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 |
#disable ⇒ Object
77 78 79 |
# File 'lib/selenium/devtools/v128/runtime.rb', line 77 def disable @devtools.send_cmd('Runtime.disable') end |
#discard_console_entries ⇒ Object
81 82 83 |
# File 'lib/selenium/devtools/v128/runtime.rb', line 81 def discard_console_entries @devtools.send_cmd('Runtime.discardConsoleEntries') end |
#enable ⇒ Object
85 86 87 |
# File 'lib/selenium/devtools/v128/runtime.rb', line 85 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, unique_context_id: nil, serialization_options: nil) ⇒ Object
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/selenium/devtools/v128/runtime.rb', line 89 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, unique_context_id: nil, serialization_options: 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, uniqueContextId: unique_context_id, serializationOptions: ) end |
#get_exception_details(error_object_id:) ⇒ Object
194 195 196 197 |
# File 'lib/selenium/devtools/v128/runtime.rb', line 194 def get_exception_details(error_object_id:) @devtools.send_cmd('Runtime.getExceptionDetails', errorObjectId: error_object_id) end |
#get_heap_usage ⇒ Object
113 114 115 |
# File 'lib/selenium/devtools/v128/runtime.rb', line 113 def get_heap_usage @devtools.send_cmd('Runtime.getHeapUsage') end |
#get_isolate_id ⇒ Object
109 110 111 |
# File 'lib/selenium/devtools/v128/runtime.rb', line 109 def get_isolate_id @devtools.send_cmd('Runtime.getIsolateId') end |
#get_properties(object_id:, own_properties: nil, accessor_properties_only: nil, generate_preview: nil, non_indexed_properties_only: nil) ⇒ Object
117 118 119 120 121 122 123 124 |
# File 'lib/selenium/devtools/v128/runtime.rb', line 117 def get_properties(object_id:, own_properties: nil, accessor_properties_only: nil, generate_preview: nil, non_indexed_properties_only: nil) @devtools.send_cmd('Runtime.getProperties', objectId: object_id, ownProperties: own_properties, accessorPropertiesOnly: accessor_properties_only, generatePreview: generate_preview, nonIndexedPropertiesOnly: non_indexed_properties_only) end |
#global_lexical_scope_names(execution_context_id: nil) ⇒ Object
126 127 128 129 |
# File 'lib/selenium/devtools/v128/runtime.rb', line 126 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/v128/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
131 132 133 134 135 |
# File 'lib/selenium/devtools/v128/runtime.rb', line 131 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
137 138 139 140 |
# File 'lib/selenium/devtools/v128/runtime.rb', line 137 def release_object(object_id:) @devtools.send_cmd('Runtime.releaseObject', objectId: object_id) end |
#release_object_group(object_group:) ⇒ Object
142 143 144 145 |
# File 'lib/selenium/devtools/v128/runtime.rb', line 142 def release_object_group(object_group:) @devtools.send_cmd('Runtime.releaseObjectGroup', objectGroup: object_group) end |
#remove_binding(name:) ⇒ Object
189 190 191 192 |
# File 'lib/selenium/devtools/v128/runtime.rb', line 189 def remove_binding(name:) @devtools.send_cmd('Runtime.removeBinding', name: name) end |
#run_if_waiting_for_debugger ⇒ Object
147 148 149 |
# File 'lib/selenium/devtools/v128/runtime.rb', line 147 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
151 152 153 154 155 156 157 158 159 160 161 |
# File 'lib/selenium/devtools/v128/runtime.rb', line 151 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
163 164 165 166 |
# File 'lib/selenium/devtools/v128/runtime.rb', line 163 def set_async_call_stack_depth(max_depth:) @devtools.send_cmd('Runtime.setAsyncCallStackDepth', maxDepth: max_depth) end |
#set_custom_object_formatter_enabled(enabled:) ⇒ Object
168 169 170 171 |
# File 'lib/selenium/devtools/v128/runtime.rb', line 168 def set_custom_object_formatter_enabled(enabled:) @devtools.send_cmd('Runtime.setCustomObjectFormatterEnabled', enabled: enabled) end |
#set_max_call_stack_size_to_capture(size:) ⇒ Object
173 174 175 176 |
# File 'lib/selenium/devtools/v128/runtime.rb', line 173 def set_max_call_stack_size_to_capture(size:) @devtools.send_cmd('Runtime.setMaxCallStackSizeToCapture', size: size) end |
#terminate_execution ⇒ Object
178 179 180 |
# File 'lib/selenium/devtools/v128/runtime.rb', line 178 def terminate_execution @devtools.send_cmd('Runtime.terminateExecution') end |