Class: Selenium::DevTools::V131::Accessibility

Inherits:
Object
  • Object
show all
Defined in:
lib/selenium/devtools/v131/accessibility.rb

Constant Summary collapse

EVENTS =
{
  load_complete: 'loadComplete',
  nodes_updated: 'nodesUpdated',
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(devtools) ⇒ Accessibility

Returns a new instance of Accessibility.



30
31
32
# File 'lib/selenium/devtools/v131/accessibility.rb', line 30

def initialize(devtools)
  @devtools = devtools
end

Instance Method Details

#disableObject



39
40
41
# File 'lib/selenium/devtools/v131/accessibility.rb', line 39

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

#enableObject



43
44
45
# File 'lib/selenium/devtools/v131/accessibility.rb', line 43

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

#get_ax_node_and_ancestors(node_id: nil, backend_node_id: nil, object_id: nil) ⇒ Object



66
67
68
69
70
71
# File 'lib/selenium/devtools/v131/accessibility.rb', line 66

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

#get_child_ax_nodes(id:, frame_id: nil) ⇒ Object



73
74
75
76
77
# File 'lib/selenium/devtools/v131/accessibility.rb', line 73

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

#get_full_ax_tree(depth: nil, frame_id: nil) ⇒ Object



55
56
57
58
59
# File 'lib/selenium/devtools/v131/accessibility.rb', line 55

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

#get_partial_ax_tree(node_id: nil, backend_node_id: nil, object_id: nil, fetch_relatives: nil) ⇒ Object



47
48
49
50
51
52
53
# File 'lib/selenium/devtools/v131/accessibility.rb', line 47

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

#get_root_ax_node(frame_id: nil) ⇒ Object



61
62
63
64
# File 'lib/selenium/devtools/v131/accessibility.rb', line 61

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

#on(event, &block) ⇒ Object



34
35
36
37
# File 'lib/selenium/devtools/v131/accessibility.rb', line 34

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

#query_ax_tree(node_id: nil, backend_node_id: nil, object_id: nil, accessible_name: nil, role: nil) ⇒ Object



79
80
81
82
83
84
85
86
# File 'lib/selenium/devtools/v131/accessibility.rb', line 79

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