# 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 BrowsingContext < Domain
          EVENTS = {
            context_created: 'browsingContext.contextCreated',
            context_destroyed: 'browsingContext.contextDestroyed',
            dom_content_loaded: 'browsingContext.domContentLoaded',
            download_end: 'browsingContext.downloadEnd',
            download_will_begin: 'browsingContext.downloadWillBegin',
            fragment_navigated: 'browsingContext.fragmentNavigated',
            history_updated: 'browsingContext.historyUpdated',
            load: 'browsingContext.load',
            navigation_aborted: 'browsingContext.navigationAborted',
            navigation_committed: 'browsingContext.navigationCommitted',
            navigation_failed: 'browsingContext.navigationFailed',
            navigation_started: 'browsingContext.navigationStarted',
            user_prompt_closed: 'browsingContext.userPromptClosed',
            user_prompt_opened: 'browsingContext.userPromptOpened'
          }.freeze

          READINESS_STATE = {
            none: 'none',
            interactive: 'interactive',
            complete: 'complete'
          }.freeze

          USER_PROMPT_TYPE = {
            alert: 'alert',
            beforeunload: 'beforeunload',
            confirm: 'confirm',
            prompt: 'prompt'
          }.freeze

          CREATE_TYPE = {
            tab: 'tab',
            window: 'window'
          }.freeze

          INNER_TEXT_LOCATOR_MATCH_TYPE = {
            full: 'full',
            partial: 'partial'
          }.freeze

          CAPTURE_SCREENSHOT_PARAMETERS_ORIGIN = {
            viewport: 'viewport',
            document: 'document'
          }.freeze

          PRINT_PARAMETERS_ORIENTATION = {
            portrait: 'portrait',
            landscape: 'landscape'
          }.freeze

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          Info = Serialization::Record.define(
            children: {wire_key: 'children', nullable: true, ref: 'BrowsingContext::Info', list: true},
            client_window: 'clientWindow',
            context: 'context',
            original_opener: {wire_key: 'originalOpener', nullable: true},
            url: {wire_key: 'url', primitive: 'string'},
            user_context: 'userContext',
            parent: {wire_key: 'parent', required: false, nullable: true}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          class Locator < Serialization::Union
            discriminator 'type', {
              accessibility: 'accessibility',
              css: 'css',
              context: 'context',
              inner_text: 'innerText',
              xpath: 'xpath'
            }
            variants(
              accessibility: 'BrowsingContext::AccessibilityLocator',
              css: 'BrowsingContext::CssLocator',
              context: 'BrowsingContext::ContextLocator',
              inner_text: 'BrowsingContext::InnerTextLocator',
              xpath: 'BrowsingContext::XPathLocator'
            )
          end

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          AccessibilityLocator = Serialization::Record.define(
            type: {fixed: 'accessibility'},
            value: {wire_key: 'value', ref: 'BrowsingContext::AccessibilityLocator::Value'}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          AccessibilityLocator::Value = Serialization::Record.define(
            name: {wire_key: 'name', required: false, primitive: 'string'},
            role: {wire_key: 'role', required: false, primitive: 'string'}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          CssLocator = Serialization::Record.define(
            type: {fixed: 'css'},
            value: {wire_key: 'value', primitive: 'string'}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          ContextLocator = Serialization::Record.define(
            type: {fixed: 'context'},
            value: {wire_key: 'value', ref: 'BrowsingContext::ContextLocator::Value'}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          ContextLocator::Value = Serialization::Record.define(context: 'context')

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          InnerTextLocator = Serialization::Record.define(
            type: {fixed: 'innerText'},
            value: {wire_key: 'value', primitive: 'string'},
            ignore_case: {wire_key: 'ignoreCase', required: false, primitive: 'boolean'},
            match_type: {wire_key: 'matchType', required: false, enum: 'BrowsingContext::INNER_TEXT_LOCATOR_MATCH_TYPE'},
            max_depth: {wire_key: 'maxDepth', required: false}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          XPathLocator = Serialization::Record.define(
            type: {fixed: 'xpath'},
            value: {wire_key: 'value', primitive: 'string'}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          BaseNavigationInfo = Serialization::Record.define(
            context: 'context',
            navigation: {wire_key: 'navigation', nullable: true},
            timestamp: 'timestamp',
            url: {wire_key: 'url', primitive: 'string'},
            user_context: {wire_key: 'userContext', required: false}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          NavigationInfo = Serialization::Record.define(
            context: 'context',
            navigation: {wire_key: 'navigation', nullable: true},
            timestamp: 'timestamp',
            url: {wire_key: 'url', primitive: 'string'},
            user_context: {wire_key: 'userContext', required: false}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          ActivateParameters = Serialization::Record.define(context: 'context')

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          CaptureScreenshotParameters = Serialization::Record.define(
            context: 'context',
            origin: {wire_key: 'origin', required: false, enum: 'BrowsingContext::CAPTURE_SCREENSHOT_PARAMETERS_ORIGIN'},
            format: {wire_key: 'format', required: false, ref: 'BrowsingContext::ImageFormat'},
            clip: {wire_key: 'clip', required: false, ref: 'BrowsingContext::ClipRectangle'}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          ImageFormat = Serialization::Record.define(
            type: {wire_key: 'type', primitive: 'string'},
            quality: {wire_key: 'quality', required: false, primitive: 'integer'}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          class ClipRectangle < Serialization::Union
            discriminator 'type', {box: 'box', element: 'element'}
            variants(
              box: 'BrowsingContext::BoxClipRectangle',
              element: 'BrowsingContext::ElementClipRectangle'
            )
          end

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          ElementClipRectangle = Serialization::Record.define(
            type: {fixed: 'element'},
            element: {wire_key: 'element', ref: 'Script::SharedReference'}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          BoxClipRectangle = Serialization::Record.define(
            type: {fixed: 'box'},
            x: {wire_key: 'x', primitive: 'number'},
            y: {wire_key: 'y', primitive: 'number'},
            width: {wire_key: 'width', primitive: 'number'},
            height: {wire_key: 'height', primitive: 'number'}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          CaptureScreenshotResult = Serialization::Record.define(data: {wire_key: 'data', primitive: 'string'})

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          CloseParameters = Serialization::Record.define(
            context: 'context',
            prompt_unload: {wire_key: 'promptUnload', required: false, primitive: 'boolean'}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          CreateParameters = Serialization::Record.define(
            type: {wire_key: 'type', enum: 'BrowsingContext::CREATE_TYPE'},
            reference_context: {wire_key: 'referenceContext', required: false},
            background: {wire_key: 'background', required: false, primitive: 'boolean'},
            user_context: {wire_key: 'userContext', required: false}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          CreateResult = Serialization::Record.define(
            context: 'context',
            user_context: {wire_key: 'userContext', required: false}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          GetTreeParameters = Serialization::Record.define(
            max_depth: {wire_key: 'maxDepth', required: false},
            root: {wire_key: 'root', required: false}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          GetTreeResult = Serialization::Record.define(
            contexts: {wire_key: 'contexts', ref: 'BrowsingContext::Info', list: true}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          HandleUserPromptParameters = Serialization::Record.define(
            context: 'context',
            accept: {wire_key: 'accept', required: false, primitive: 'boolean'},
            user_text: {wire_key: 'userText', required: false, primitive: 'string'}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          LocateNodesParameters = Serialization::Record.define(
            context: 'context',
            locator: {wire_key: 'locator', ref: 'BrowsingContext::Locator'},
            max_node_count: {wire_key: 'maxNodeCount', required: false},
            serialization_options: {
              wire_key: 'serializationOptions',
              required: false,
              ref: 'Script::SerializationOptions'
            },
            start_nodes: {wire_key: 'startNodes', required: false, ref: 'Script::SharedReference', list: true}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          LocateNodesResult = Serialization::Record.define(
            nodes: {wire_key: 'nodes', ref: 'Script::NodeRemoteValue', list: true}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          NavigateParameters = Serialization::Record.define(
            context: 'context',
            url: {wire_key: 'url', primitive: 'string'},
            wait: {wire_key: 'wait', required: false, enum: 'BrowsingContext::READINESS_STATE'}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          NavigateResult = Serialization::Record.define(
            navigation: {wire_key: 'navigation', nullable: true},
            url: {wire_key: 'url', primitive: 'string'}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          PrintParameters = Serialization::Record.define(
            context: 'context',
            background: {wire_key: 'background', required: false, primitive: 'boolean'},
            margin: {wire_key: 'margin', required: false, ref: 'BrowsingContext::PrintMarginParameters'},
            orientation: {
              wire_key: 'orientation',
              required: false,
              enum: 'BrowsingContext::PRINT_PARAMETERS_ORIENTATION'
            },
            page: {wire_key: 'page', required: false, ref: 'BrowsingContext::PrintPageParameters'},
            page_ranges: {wire_key: 'pageRanges', required: false, list: true},
            scale: {wire_key: 'scale', required: false, primitive: 'number'},
            shrink_to_fit: {wire_key: 'shrinkToFit', required: false, primitive: 'boolean'}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          PrintMarginParameters = Serialization::Record.define(
            bottom: {wire_key: 'bottom', required: false, primitive: 'number'},
            left: {wire_key: 'left', required: false, primitive: 'number'},
            right: {wire_key: 'right', required: false, primitive: 'number'},
            top: {wire_key: 'top', required: false, primitive: 'number'}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          PrintPageParameters = Serialization::Record.define(
            height: {wire_key: 'height', required: false, primitive: 'number'},
            width: {wire_key: 'width', required: false, primitive: 'number'}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          PrintResult = Serialization::Record.define(data: {wire_key: 'data', primitive: 'string'})

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          ReloadParameters = Serialization::Record.define(
            context: 'context',
            ignore_cache: {wire_key: 'ignoreCache', required: false, primitive: 'boolean'},
            wait: {wire_key: 'wait', required: false, enum: 'BrowsingContext::READINESS_STATE'}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          SetBypassCSPParameters = Serialization::Record.define(
            bypass: {wire_key: 'bypass', nullable: 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/
          SetViewportParameters = Serialization::Record.define(
            context: {wire_key: 'context', required: false},
            viewport: {wire_key: 'viewport', required: false, nullable: true, ref: 'BrowsingContext::Viewport'},
            device_pixel_ratio: {wire_key: 'devicePixelRatio', required: false, nullable: true, primitive: 'number'},
            user_contexts: {wire_key: 'userContexts', required: false, list: true}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          Viewport = Serialization::Record.define(width: 'width', height: 'height')

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          StartScreencastParameters = Serialization::Record.define(
            context: 'context',
            mime_type: {wire_key: 'mimeType', required: false, primitive: 'string'},
            video: {wire_key: 'video', required: false, ref: 'BrowsingContext::MediaTrackConstraints'},
            audio: {wire_key: 'audio', required: false, primitive: 'boolean'}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          MediaTrackConstraints = Serialization::Record.define(
            width: {wire_key: 'width', required: false},
            height: {wire_key: 'height', required: false},
            frame_rate: {wire_key: 'frameRate', required: false}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          StartScreencastResult = Serialization::Record.define(
            screencast: 'screencast',
            path: {wire_key: 'path', primitive: 'string'}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          StopScreencastParameters = Serialization::Record.define(screencast: 'screencast')

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          StopScreencastResult = Serialization::Record.define(
            path: {wire_key: 'path', primitive: 'string'},
            error: {wire_key: 'error', required: false, primitive: 'string'}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          TraverseHistoryParameters = Serialization::Record.define(context: 'context', delta: 'delta')

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          HistoryUpdatedParameters = Serialization::Record.define(
            context: 'context',
            timestamp: 'timestamp',
            url: {wire_key: 'url', primitive: 'string'},
            user_context: {wire_key: 'userContext', required: false}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          DownloadWillBeginParams = Serialization::Record.define(
            download: 'download',
            suggested_filename: {wire_key: 'suggestedFilename', primitive: 'string'},
            context: 'context',
            navigation: {wire_key: 'navigation', nullable: true},
            timestamp: 'timestamp',
            url: {wire_key: 'url', primitive: 'string'},
            user_context: {wire_key: 'userContext', required: false}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          class DownloadEndParams < Serialization::Union
            discriminator 'status', {canceled: 'canceled', complete: 'complete'}
            variants(
              canceled: 'BrowsingContext::DownloadEndParams::CanceledParams',
              complete: 'BrowsingContext::DownloadEndParams::CompleteParams'
            )

            # @api private
            # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
            CanceledParams = Serialization::Record.define(
              status: {fixed: 'canceled'},
              download: 'download',
              context: 'context',
              navigation: {wire_key: 'navigation', nullable: true},
              timestamp: 'timestamp',
              url: {wire_key: 'url', primitive: 'string'},
              user_context: {wire_key: 'userContext', required: false}
            )

            # @api private
            # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
            CompleteParams = Serialization::Record.define(
              status: {fixed: 'complete'},
              download: 'download',
              filepath: {wire_key: 'filepath', nullable: true, primitive: 'string'},
              context: 'context',
              navigation: {wire_key: 'navigation', nullable: true},
              timestamp: 'timestamp',
              url: {wire_key: 'url', primitive: 'string'},
              user_context: {wire_key: 'userContext', required: false}
            )
          end

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          UserPromptClosedParameters = Serialization::Record.define(
            context: 'context',
            accepted: {wire_key: 'accepted', primitive: 'boolean'},
            type: {wire_key: 'type', enum: 'BrowsingContext::USER_PROMPT_TYPE'},
            user_context: {wire_key: 'userContext', required: false},
            user_text: {wire_key: 'userText', required: false, primitive: 'string'}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          UserPromptOpenedParameters = Serialization::Record.define(
            context: 'context',
            handler: {wire_key: 'handler', enum: 'Session::USER_PROMPT_HANDLER_TYPE'},
            message: {wire_key: 'message', primitive: 'string'},
            type: {wire_key: 'type', enum: 'BrowsingContext::USER_PROMPT_TYPE'},
            user_context: {wire_key: 'userContext', required: false},
            default_value: {wire_key: 'defaultValue', required: false, primitive: 'string'}
          )

          EVENT_TYPES = {
            'browsingContext.contextCreated' => BrowsingContext::Info,
            'browsingContext.contextDestroyed' => BrowsingContext::Info,
            'browsingContext.domContentLoaded' => BrowsingContext::NavigationInfo,
            'browsingContext.downloadEnd' => BrowsingContext::DownloadEndParams,
            'browsingContext.downloadWillBegin' => BrowsingContext::DownloadWillBeginParams,
            'browsingContext.fragmentNavigated' => BrowsingContext::NavigationInfo,
            'browsingContext.historyUpdated' => BrowsingContext::HistoryUpdatedParameters,
            'browsingContext.load' => BrowsingContext::NavigationInfo,
            'browsingContext.navigationAborted' => BrowsingContext::NavigationInfo,
            'browsingContext.navigationCommitted' => BrowsingContext::NavigationInfo,
            'browsingContext.navigationFailed' => BrowsingContext::NavigationInfo,
            'browsingContext.navigationStarted' => BrowsingContext::NavigationInfo,
            'browsingContext.userPromptClosed' => BrowsingContext::UserPromptClosedParameters,
            'browsingContext.userPromptOpened' => BrowsingContext::UserPromptOpenedParameters
          }.freeze

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          def activate(context:)
            params = ActivateParameters.new(context: context)
            execute(cmd: 'browsingContext.activate', params: params)
          end

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          def capture_screenshot(
            context:,
            origin: Serialization::UNSET,
            format: Serialization::UNSET,
            clip: Serialization::UNSET
          )
            Serialization.validate!('origin', origin, BrowsingContext::CAPTURE_SCREENSHOT_PARAMETERS_ORIGIN)
            params = CaptureScreenshotParameters.new(context: context, origin: origin, format: format, clip: clip)
            execute(
              cmd: 'browsingContext.captureScreenshot',
              params: params,
              result: BrowsingContext::CaptureScreenshotResult
            )
          end

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          def close(context:, prompt_unload: Serialization::UNSET)
            params = CloseParameters.new(context: context, prompt_unload: prompt_unload)
            execute(cmd: 'browsingContext.close', params: params)
          end

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          def create(
            type:,
            reference_context: Serialization::UNSET,
            background: Serialization::UNSET,
            user_context: Serialization::UNSET
          )
            Serialization.validate!('type', type, BrowsingContext::CREATE_TYPE)
            params = CreateParameters.new(
              type: type,
              reference_context: reference_context,
              background: background,
              user_context: user_context
            )
            execute(cmd: 'browsingContext.create', params: params, result: BrowsingContext::CreateResult)
          end

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          def get_tree(max_depth: Serialization::UNSET, root: Serialization::UNSET)
            params = GetTreeParameters.new(max_depth: max_depth, root: root)
            execute(cmd: 'browsingContext.getTree', params: params, result: BrowsingContext::GetTreeResult)
          end

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          def handle_user_prompt(context:, accept: Serialization::UNSET, user_text: Serialization::UNSET)
            params = HandleUserPromptParameters.new(context: context, accept: accept, user_text: user_text)
            execute(cmd: 'browsingContext.handleUserPrompt', params: params)
          end

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          def locate_nodes(
            context:,
            locator:,
            max_node_count: Serialization::UNSET,
            serialization_options: Serialization::UNSET,
            start_nodes: Serialization::UNSET
          )
            params = LocateNodesParameters.new(
              context: context,
              locator: locator,
              max_node_count: max_node_count,
              serialization_options: serialization_options,
              start_nodes: start_nodes
            )
            execute(cmd: 'browsingContext.locateNodes', params: params, result: BrowsingContext::LocateNodesResult)
          end

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          def navigate(context:, url:, wait: Serialization::UNSET)
            Serialization.validate!('wait', wait, BrowsingContext::READINESS_STATE)
            params = NavigateParameters.new(context: context, url: url, wait: wait)
            execute(cmd: 'browsingContext.navigate', params: params, result: BrowsingContext::NavigateResult)
          end

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          def print(
            context:,
            background: Serialization::UNSET,
            margin: Serialization::UNSET,
            orientation: Serialization::UNSET,
            page: Serialization::UNSET,
            page_ranges: Serialization::UNSET,
            scale: Serialization::UNSET,
            shrink_to_fit: Serialization::UNSET
          )
            Serialization.validate!('orientation', orientation, BrowsingContext::PRINT_PARAMETERS_ORIENTATION)
            params = PrintParameters.new(
              context: context,
              background: background,
              margin: margin,
              orientation: orientation,
              page: page,
              page_ranges: page_ranges,
              scale: scale,
              shrink_to_fit: shrink_to_fit
            )
            execute(cmd: 'browsingContext.print', params: params, result: BrowsingContext::PrintResult)
          end

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          def reload(context:, ignore_cache: Serialization::UNSET, wait: Serialization::UNSET)
            Serialization.validate!('wait', wait, BrowsingContext::READINESS_STATE)
            params = ReloadParameters.new(context: context, ignore_cache: ignore_cache, wait: wait)
            execute(cmd: 'browsingContext.reload', params: params, result: BrowsingContext::NavigateResult)
          end

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          def set_bypass_csp(bypass:, contexts: Serialization::UNSET, user_contexts: Serialization::UNSET)
            params = SetBypassCSPParameters.new(bypass: bypass, contexts: contexts, user_contexts: user_contexts)
            execute(cmd: 'browsingContext.setBypassCSP', params: params)
          end

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          def set_viewport(
            context: Serialization::UNSET,
            viewport: Serialization::UNSET,
            device_pixel_ratio: Serialization::UNSET,
            user_contexts: Serialization::UNSET
          )
            params = SetViewportParameters.new(
              context: context,
              viewport: viewport,
              device_pixel_ratio: device_pixel_ratio,
              user_contexts: user_contexts
            )
            execute(cmd: 'browsingContext.setViewport', params: params)
          end

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          def start_screencast(
            context:,
            mime_type: Serialization::UNSET,
            video: Serialization::UNSET,
            audio: Serialization::UNSET
          )
            params = StartScreencastParameters.new(context: context, mime_type: mime_type, video: video, audio: audio)
            execute(
              cmd: 'browsingContext.startScreencast',
              params: params,
              result: BrowsingContext::StartScreencastResult
            )
          end

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          def stop_screencast(screencast:)
            params = StopScreencastParameters.new(screencast: screencast)
            execute(
              cmd: 'browsingContext.stopScreencast',
              params: params,
              result: BrowsingContext::StopScreencastResult
            )
          end

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          def traverse_history(context:, delta:)
            params = TraverseHistoryParameters.new(context: context, delta: delta)
            execute(cmd: 'browsingContext.traverseHistory', params: params)
          end
        end # BrowsingContext
      end # Protocol
    end # BiDi
  end # WebDriver
end # Selenium
