# 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 V136
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, inherit_permissions: nil)
@devtools.send_cmd('Target.exposeDevToolsProtocol',
targetId: target_id,
bindingName: binding_name,
inheritPermissions: inherit_permissions)
end
def create_browser_context(dispose_on_detach: nil, proxy_server: nil, proxy_bypass_list: nil, origins_with_universal_network_access: nil)
@devtools.send_cmd('Target.createBrowserContext',
disposeOnDetach: dispose_on_detach,
proxyServer: proxy_server,
proxyBypassList: proxy_bypass_list,
originsWithUniversalNetworkAccess: origins_with_universal_network_access)
end
def get_browser_contexts
@devtools.send_cmd('Target.getBrowserContexts')
end
def create_target(url:, left: nil, top: nil, width: nil, height: nil, window_state: nil, browser_context_id: nil, enable_begin_frame_control: nil, new_window: nil, background: nil, for_tab: nil)
@devtools.send_cmd('Target.createTarget',
url: url,
left: left,
top: top,
width: width,
height: height,
windowState: window_state,
browserContextId: browser_context_id,
enableBeginFrameControl: enable_begin_frame_control,
newWindow: new_window,
background: background,
forTab: for_tab)
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(filter: nil)
@devtools.send_cmd('Target.getTargets',
filter: filter)
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, filter: nil)
@devtools.send_cmd('Target.setAutoAttach',
autoAttach: auto_attach,
waitForDebuggerOnStart: wait_for_debugger_on_start,
flatten: flatten,
filter: filter)
end
def auto_attach_related(target_id:, wait_for_debugger_on_start:, filter: nil)
@devtools.send_cmd('Target.autoAttachRelated',
targetId: target_id,
waitForDebuggerOnStart: wait_for_debugger_on_start,
filter: filter)
end
def set_discover_targets(discover:, filter: nil)
@devtools.send_cmd('Target.setDiscoverTargets',
discover: discover,
filter: filter)
end
def set_remote_locations(locations:)
@devtools.send_cmd('Target.setRemoteLocations',
locations: locations)
end
end # Target
end # V136
end # DevTools
end # Selenium