# 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. DO NOT EDIT!
# Regenerate with: bazel run //rb/lib/selenium/webdriver:bidi-generate
module Selenium
module WebDriver
class BiDi
module Protocol
# @api private
# @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
class Session < Domain
USER_PROMPT_HANDLER_TYPE = {
accept: 'accept',
dismiss: 'dismiss',
ignore: 'ignore'
}.freeze
# @api private
# @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
CapabilitiesRequest = Serialization::Record.define(
always_match: {wire_key: 'alwaysMatch', required: false, ref: 'Session::CapabilityRequest'},
first_match: {wire_key: 'firstMatch', required: false, ref: 'Session::CapabilityRequest', list: true}
)
# @api private
# @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
CapabilityRequest = Serialization::Record.define(
accept_insecure_certs: {wire_key: 'acceptInsecureCerts', required: false, primitive: 'boolean'},
browser_name: {wire_key: 'browserName', required: false, primitive: 'string'},
browser_version: {wire_key: 'browserVersion', required: false, primitive: 'string'},
platform_name: {wire_key: 'platformName', required: false, primitive: 'string'},
proxy: {wire_key: 'proxy', required: false, ref: 'Session::ProxyConfiguration'},
unhandled_prompt_behavior: {
wire_key: 'unhandledPromptBehavior',
required: false,
ref: 'Session::UserPromptHandler'
},
extensible: true
)
# @api private
# @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
class ProxyConfiguration < Serialization::Union
discriminator 'proxyType', {
autodetect: 'autodetect',
direct: 'direct',
manual: 'manual',
pac: 'pac',
system: 'system'
}
variants(
autodetect: 'Session::AutodetectProxyConfiguration',
direct: 'Session::DirectProxyConfiguration',
manual: 'Session::ManualProxyConfiguration',
pac: 'Session::PacProxyConfiguration',
system: 'Session::SystemProxyConfiguration'
)
end
# @api private
# @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
AutodetectProxyConfiguration = Serialization::Record.define(
proxy_type: {wire_key: 'proxyType', fixed: 'autodetect'},
extensible: true
)
# @api private
# @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
DirectProxyConfiguration = Serialization::Record.define(
proxy_type: {wire_key: 'proxyType', fixed: 'direct'},
extensible: true
)
# @api private
# @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
ManualProxyConfiguration = Serialization::Record.define(
proxy_type: {wire_key: 'proxyType', fixed: 'manual'},
http_proxy: {wire_key: 'httpProxy', required: false, primitive: 'string'},
ssl_proxy: {wire_key: 'sslProxy', required: false, primitive: 'string'},
socks_proxy: {wire_key: 'socksProxy', primitive: 'string'},
socks_version: {wire_key: 'socksVersion', primitive: 'integer'},
no_proxy: {wire_key: 'noProxy', required: false, list: true},
extensible: true
)
# @api private
# @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
SocksProxyConfiguration = Serialization::Record.define(
socks_proxy: {wire_key: 'socksProxy', primitive: 'string'},
socks_version: {wire_key: 'socksVersion', primitive: 'integer'}
)
# @api private
# @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
PacProxyConfiguration = Serialization::Record.define(
proxy_type: {wire_key: 'proxyType', fixed: 'pac'},
proxy_autoconfig_url: {wire_key: 'proxyAutoconfigUrl', primitive: 'string'},
extensible: true
)
# @api private
# @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
SystemProxyConfiguration = Serialization::Record.define(
proxy_type: {wire_key: 'proxyType', fixed: 'system'},
extensible: true
)
# @api private
# @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
UserPromptHandler = Serialization::Record.define(
alert: {wire_key: 'alert', required: false, enum: 'Session::USER_PROMPT_HANDLER_TYPE'},
before_unload: {wire_key: 'beforeUnload', required: false, enum: 'Session::USER_PROMPT_HANDLER_TYPE'},
confirm: {wire_key: 'confirm', required: false, enum: 'Session::USER_PROMPT_HANDLER_TYPE'},
default: {wire_key: 'default', required: false, enum: 'Session::USER_PROMPT_HANDLER_TYPE'},
file: {wire_key: 'file', required: false, enum: 'Session::USER_PROMPT_HANDLER_TYPE'},
prompt: {wire_key: 'prompt', required: false, enum: 'Session::USER_PROMPT_HANDLER_TYPE'}
)
# @api private
# @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
SubscribeParameters = Serialization::Record.define(
events: {wire_key: 'events', list: true},
contexts: {wire_key: 'contexts', required: false, list: true},
user_contexts: {wire_key: 'userContexts', required: false, list: true}
)
# @api private
# @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
UnsubscribeByIDRequest = Serialization::Record.define(subscriptions: {wire_key: 'subscriptions', list: true})
# @api private
# @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
UnsubscribeByAttributesRequest = Serialization::Record.define(events: {wire_key: 'events', list: true})
# @api private
# @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
StatusResult = Serialization::Record.define(
ready: {wire_key: 'ready', primitive: 'boolean'},
message: {wire_key: 'message', primitive: 'string'}
)
# @api private
# @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
NewParameters = Serialization::Record.define(
capabilities: {wire_key: 'capabilities', ref: 'Session::CapabilitiesRequest'}
)
# @api private
# @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
NewResult = Serialization::Record.define(
session_id: {wire_key: 'sessionId', primitive: 'string'},
capabilities: {wire_key: 'capabilities', ref: 'Session::NewResult::Capabilities'}
)
# @api private
# @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
NewResult::Capabilities = Serialization::Record.define(
accept_insecure_certs: {wire_key: 'acceptInsecureCerts', primitive: 'boolean'},
browser_name: {wire_key: 'browserName', primitive: 'string'},
browser_version: {wire_key: 'browserVersion', primitive: 'string'},
platform_name: {wire_key: 'platformName', primitive: 'string'},
set_window_rect: {wire_key: 'setWindowRect', primitive: 'boolean'},
user_agent: {wire_key: 'userAgent', primitive: 'string'},
proxy: {wire_key: 'proxy', required: false, ref: 'Session::ProxyConfiguration'},
unhandled_prompt_behavior: {
wire_key: 'unhandledPromptBehavior',
required: false,
ref: 'Session::UserPromptHandler'
},
web_socket_url: {wire_key: 'webSocketUrl', required: false, primitive: 'string'},
extensible: true
)
# @api private
# @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
SubscribeResult = Serialization::Record.define(subscription: 'subscription')
# @api private
# @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
class UnsubscribeParameters < Serialization::Union
presence(
'Session::UnsubscribeByAttributesRequest' => ['events'],
'Session::UnsubscribeByIDRequest' => ['subscriptions']
)
end
# @api private
# @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
def end_
execute(cmd: 'session.end')
end
# @api private
# @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
def new(capabilities:)
params = NewParameters.new(capabilities: capabilities)
execute(cmd: 'session.new', params: params, result: Session::NewResult)
end
# @api private
# @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
def status
execute(cmd: 'session.status', result: Session::StatusResult)
end
# @api private
# @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
def subscribe(events:, contexts: Serialization::UNSET, user_contexts: Serialization::UNSET)
params = SubscribeParameters.new(events: events, contexts: contexts, user_contexts: user_contexts)
execute(cmd: 'session.subscribe', params: params, result: Session::SubscribeResult)
end
# @api private
# @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
def unsubscribe(events: Serialization::UNSET, subscriptions: Serialization::UNSET)
params = UnsubscribeParameters.build(events: events, subscriptions: subscriptions)
execute(cmd: 'session.unsubscribe', params: params)
end
end # Session
end # Protocol
end # BiDi
end # WebDriver
end # Selenium