# 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 WebDriver class DevTools def target @target ||= V87::Target.new(self) end module V87 class Target EVENTS = { attached_to_target: 'attachedToTarget', detached_from_target: 'detachedFromTarget', received_message_from_target: 'receivedMessageFromTarget', target_created: 'targetCreated', target_destroyed: 'targetDestroyed', target_crashed: 'targetCrashed', target_info_changed: 'targetInfoChanged' }.freeze def initialize(devtools) @devtools = devtools end def on(event, &block) event = EVENTS[event] if event.is_a?(Symbol) @devtools.callbacks["Target.#{event}"] << block end def activate_target(target_id:) @devtools.send_cmd('Target.activateTarget', targetId: target_id) end def attach_to_target(target_id:, flatten: nil) @devtools.send_cmd('Target.attachToTarget', targetId: target_id, flatten: flatten) end def attach_to_browser_target @devtools.send_cmd('Target.attachToBrowserTarget') end def close_target(target_id:) @devtools.send_cmd('Target.closeTarget', targetId: target_id) end def expose_dev_tools_protocol(target_id:, binding_name: nil) @devtools.send_cmd('Target.exposeDevToolsProtocol', targetId: target_id, bindingName: binding_name) end def create_browser_context(dispose_on_detach: nil, proxy_server: nil, proxy_bypass_list: nil) @devtools.send_cmd('Target.createBrowserContext', disposeOnDetach: dispose_on_detach, proxyServer: proxy_server, proxyBypassList: proxy_bypass_list) end def get_browser_contexts @devtools.send_cmd('Target.getBrowserContexts') end def create_target(url:, width: nil, height: nil, browser_context_id: nil, enable_begin_frame_control: nil, new_window: nil, background: nil) @devtools.send_cmd('Target.createTarget', url: url, width: width, height: height, browserContextId: browser_context_id, enableBeginFrameControl: enable_begin_frame_control, newWindow: new_window, background: background) end def detach_from_target(session_id: nil, target_id: nil) @devtools.send_cmd('Target.detachFromTarget', sessionId: session_id, targetId: target_id) end def dispose_browser_context(browser_context_id:) @devtools.send_cmd('Target.disposeBrowserContext', browserContextId: browser_context_id) end def get_target_info(target_id: nil) @devtools.send_cmd('Target.getTargetInfo', targetId: target_id) end def get_targets @devtools.send_cmd('Target.getTargets') end def send_message_to_target(message:, session_id: nil, target_id: nil) @devtools.send_cmd('Target.sendMessageToTarget', message: message, sessionId: session_id, targetId: target_id) end def set_auto_attach(auto_attach:, wait_for_debugger_on_start:, flatten: nil) @devtools.send_cmd('Target.setAutoAttach', autoAttach: auto_attach, waitForDebuggerOnStart: wait_for_debugger_on_start, flatten: flatten) end def set_discover_targets(discover:) @devtools.send_cmd('Target.setDiscoverTargets', discover: discover) end def set_remote_locations(locations:) @devtools.send_cmd('Target.setRemoteLocations', locations: locations) end end # V87 end # Target end # DevTools end # WebDriver end # Selenium