Class: Selenium::WebDriver::ShadowRoot

Inherits:
Object
  • Object
show all
Includes:
SearchContext
Defined in:
lib/selenium/webdriver/common/shadow_root.rb

Constant Summary collapse

ROOT_KEY =
'shadow-6066-11e4-a52e-4f735466cecf'

Constants included from SearchContext

Selenium::WebDriver::SearchContext::FINDERS

Instance Method Summary collapse

Methods included from SearchContext

#find_element, #find_elements

Constructor Details

#initialize(bridge, id) ⇒ ShadowRoot

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Creates a new shadow root


33
34
35
36
# File 'lib/selenium/webdriver/common/shadow_root.rb', line 33

def initialize(bridge, id)
  @bridge = bridge
  @id = id
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?


42
43
44
# File 'lib/selenium/webdriver/common/shadow_root.rb', line 42

def ==(other)
  other.is_a?(self.class) && ref == other.ref
end

#as_jsonObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

For Rails 3 - jonathanjulian.com/2010/04/rails-to_json-or-as_json/


77
78
79
# File 'lib/selenium/webdriver/common/shadow_root.rb', line 77

def as_json(*)
  {ROOT_KEY => @id}
end

#hashObject


47
48
49
# File 'lib/selenium/webdriver/common/shadow_root.rb', line 47

def hash
  @id.hash ^ @bridge.hash
end

#inspectObject


38
39
40
# File 'lib/selenium/webdriver/common/shadow_root.rb', line 38

def inspect
  format '#<%<class>s:0x%<hash>x id=%<id>s>', class: self.class, hash: hash * 2, id: @id.inspect
end

#refObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


56
57
58
# File 'lib/selenium/webdriver/common/shadow_root.rb', line 56

def ref
  [:shadow_root, @id]
end

#to_jsonObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Convert to a ShadowRoot JSON Object for transmission over the wire.


67
68
69
# File 'lib/selenium/webdriver/common/shadow_root.rb', line 67

def to_json(*)
  JSON.generate as_json
end