lib/selenium/devtools/v102/accessibility.rb



# 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 V102
      class Accessibility
        EVENTS = {
          load_complete: 'loadComplete',
          nodes_updated: 'nodesUpdated',
        }.freeze

        def initialize(devtools)
          @devtools = devtools
        end

        def on(event, &block)
          event = EVENTS[event] if event.is_a?(Symbol)
          @devtools.callbacks["Accessibility.#{event}"] << block
        end

        def disable
          @devtools.send_cmd('Accessibility.disable')
        end

        def enable
          @devtools.send_cmd('Accessibility.enable')
        end

        def get_partial_ax_tree(node_id: nil, backend_node_id: nil, object_id: nil, fetch_relatives: nil)
          @devtools.send_cmd('Accessibility.getPartialAXTree',
                             nodeId: node_id,
                             backendNodeId: backend_node_id,
                             objectId: object_id,
                             fetchRelatives: fetch_relatives)
        end

        def get_full_ax_tree(depth: nil, frame_id: nil)
          @devtools.send_cmd('Accessibility.getFullAXTree',
                             depth: depth,
                             frameId: frame_id)
        end

        def get_root_ax_node(frame_id: nil)
          @devtools.send_cmd('Accessibility.getRootAXNode',
                             frameId: frame_id)
        end

        def get_ax_node_and_ancestors(node_id: nil, backend_node_id: nil, object_id: nil)
          @devtools.send_cmd('Accessibility.getAXNodeAndAncestors',
                             nodeId: node_id,
                             backendNodeId: backend_node_id,
                             objectId: object_id)
        end

        def get_child_ax_nodes(id:, frame_id: nil)
          @devtools.send_cmd('Accessibility.getChildAXNodes',
                             id: id,
                             frameId: frame_id)
        end

        def query_ax_tree(node_id: nil, backend_node_id: nil, object_id: nil, accessible_name: nil, role: nil)
          @devtools.send_cmd('Accessibility.queryAXTree',
                             nodeId: node_id,
                             backendNodeId: backend_node_id,
                             objectId: object_id,
                             accessibleName: accessible_name,
                             role: role)
        end

      end # Accessibility
    end # V102
  end # DevTools
end # Selenium