# frozen_string_literal: true # Licensed to the Software Freedom Conservancy (SFC) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The SFC licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. # This file is automatically generated. Any changes will be lost! module Selenium module DevTools module V105 class Runtime 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 def initialize(devtools) @devtools = devtools end def on(event, &block) event = EVENTS[event] if event.is_a?(Symbol) @devtools.callbacks["Runtime.#{event}"] << block end 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 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, generate_web_driver_value: 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, generateWebDriverValue: generate_web_driver_value) end 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 def disable @devtools.send_cmd('Runtime.disable') end def discard_console_entries @devtools.send_cmd('Runtime.discardConsoleEntries') end def enable @devtools.send_cmd('Runtime.enable') end 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, generate_web_driver_value: 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, generateWebDriverValue: generate_web_driver_value) end def get_isolate_id @devtools.send_cmd('Runtime.getIsolateId') end def get_heap_usage @devtools.send_cmd('Runtime.getHeapUsage') end 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 def global_lexical_scope_names(execution_context_id: nil) @devtools.send_cmd('Runtime.globalLexicalScopeNames', executionContextId: execution_context_id) end def query_objects(prototype_object_id:, object_group: nil) @devtools.send_cmd('Runtime.queryObjects', prototypeObjectId: prototype_object_id, objectGroup: object_group) end def release_object(object_id:) @devtools.send_cmd('Runtime.releaseObject', objectId: object_id) end def release_object_group(object_group:) @devtools.send_cmd('Runtime.releaseObjectGroup', objectGroup: object_group) end def run_if_waiting_for_debugger @devtools.send_cmd('Runtime.runIfWaitingForDebugger') end 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 def set_async_call_stack_depth(max_depth:) @devtools.send_cmd('Runtime.setAsyncCallStackDepth', maxDepth: max_depth) end def set_custom_object_formatter_enabled(enabled:) @devtools.send_cmd('Runtime.setCustomObjectFormatterEnabled', enabled: enabled) end def set_max_call_stack_size_to_capture(size:) @devtools.send_cmd('Runtime.setMaxCallStackSizeToCapture', size: size) end def terminate_execution @devtools.send_cmd('Runtime.terminateExecution') end 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 def remove_binding(name:) @devtools.send_cmd('Runtime.removeBinding', name: name) end def get_exception_details(error_object_id:) @devtools.send_cmd('Runtime.getExceptionDetails', errorObjectId: error_object_id) end end # Runtime end # V105 end # DevTools end # Selenium