123456789_123456789_123456789_123456789_123456789_

Module: Selenium::WebDriver::AccessibilityNode::Wire Private

Relationships & Source Files
Defined in: rb/lib/selenium/webdriver/common/accessibility_snapshot.rb

Overview

The BiDi remote value shapes the snapshotter reads around the JSON text.

Class Method Summary

Class Method Details

.context_of(window) (mod_func)

The browsing context id of a window remote value; nil for a frame with no reachable context.

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/common/accessibility_snapshot.rb', line 152

def context_of(window)
  return nil unless window['type'] == 'window'

  window.dig('value', 'context')
end

.object_fields(value) (mod_func)

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/common/accessibility_snapshot.rb', line 128

def object_fields(value)
  unless value['type'] == 'object'
    raise Error::WebDriverError,
          "accessibility snapshot: expected an object remote value, got #{value['type'].inspect}"
  end

  # A property name is written as a plain string, or as a string remote value.
  value.fetch('value', []).to_h { |key, entry| [key.is_a?(String) ? key : string(key), entry] }
end

.shared_id(node) (mod_func)

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/common/accessibility_snapshot.rb', line 142

def shared_id(node)
  shared_id = node['sharedId']
  unless node['type'] == 'node' && shared_id
    raise Error::WebDriverError, 'accessibility snapshot: expected a node reference in the elements list'
  end

  shared_id.to_s
end

.string(value) (mod_func)

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/common/accessibility_snapshot.rb', line 138

def string(value)
  value.fetch('value', '').to_s
end