Class: Ferrum::Accessibility::AXNode
- Inherits:
-
Object
- Object
- Ferrum::Accessibility::AXNode
- Defined in:
- lib/ferrum/accessibility/ax_node.rb
Overview
Represents an AXNode from the CDP Accessibility domain.
Instance Method Summary collapse
-
#backend_dom_node_id ⇒ Integer?
The id of the DOM node this AX node is backed by.
-
#child_ids ⇒ Array?
The ids of this AX node's children.
-
#description ⇒ String?
The AX node's accessible description.
-
#ignored? ⇒ Boolean
Whether the node is ignored by the accessibility tree.
-
#ignored_reasons ⇒ Array?
The reasons the node is ignored, if any.
-
#initialize(params) ⇒ AXNode
constructor
A new instance of AXNode.
-
#name ⇒ String?
The AX node's accessible name.
-
#node_id ⇒ String?
The AX node's id.
-
#properties ⇒ Hash{String => Object}
ARIA/computed properties flattened to
name => value. -
#role ⇒ String?
The AX node's role, e.g.
-
#to_h ⇒ Hash
The raw CDP AXNode hash.
-
#value ⇒ String, ...
The AX node's current value.
Constructor Details
#initialize(params) ⇒ AXNode
Returns a new instance of AXNode.
14 15 16 |
# File 'lib/ferrum/accessibility/ax_node.rb', line 14 def initialize(params) @params = deep_freeze(params) end |
Instance Method Details
#backend_dom_node_id ⇒ Integer?
The id of the DOM node this AX node is backed by.
79 80 81 |
# File 'lib/ferrum/accessibility/ax_node.rb', line 79 def backend_dom_node_id @params["backendDOMNodeId"] end |
#child_ids ⇒ Array?
The ids of this AX node's children.
86 87 88 |
# File 'lib/ferrum/accessibility/ax_node.rb', line 86 def child_ids @params["childIds"] end |
#description ⇒ String?
The AX node's accessible description.
35 36 37 |
# File 'lib/ferrum/accessibility/ax_node.rb', line 35 def description @params.dig("description", "value") end |
#ignored? ⇒ Boolean
Whether the node is ignored by the accessibility tree.
58 59 60 |
# File 'lib/ferrum/accessibility/ax_node.rb', line 58 def ignored? @params["ignored"] == true end |
#ignored_reasons ⇒ Array?
The reasons the node is ignored, if any.
65 66 67 |
# File 'lib/ferrum/accessibility/ax_node.rb', line 65 def ignored_reasons @params["ignoredReasons"] end |
#name ⇒ String?
The AX node's accessible name.
28 29 30 |
# File 'lib/ferrum/accessibility/ax_node.rb', line 28 def name @params.dig("name", "value") end |
#node_id ⇒ String?
The AX node's id.
72 73 74 |
# File 'lib/ferrum/accessibility/ax_node.rb', line 72 def node_id @params["nodeId"] end |
#properties ⇒ Hash{String => Object}
ARIA/computed properties flattened to name => value.
49 50 51 52 53 |
# File 'lib/ferrum/accessibility/ax_node.rb', line 49 def properties @properties ||= Array(@params["properties"]).to_h do |property| [property["name"], property.dig("value", "value")] end.freeze end |
#role ⇒ String?
The AX node's role, e.g. "button".
21 22 23 |
# File 'lib/ferrum/accessibility/ax_node.rb', line 21 def role @params.dig("role", "value") end |
#to_h ⇒ Hash
The raw CDP AXNode hash.
93 94 95 |
# File 'lib/ferrum/accessibility/ax_node.rb', line 93 def to_h @params end |
#value ⇒ String, ...
The AX node's current value.
42 43 44 |
# File 'lib/ferrum/accessibility/ax_node.rb', line 42 def value @params.dig("value", "value") end |