Class: Capybara::Node::ShadowRoot

Inherits:
Element
  • Object
show all
Defined in:
lib/capybara/node/shadow_root.rb

Instance Method Summary collapse

Instance Method Details

#hostObject



4
5
6
# File 'lib/capybara/node/shadow_root.rb', line 4

def host
  evaluate_script("this.host")
end

#tag_nameObject



22
23
24
# File 'lib/capybara/node/shadow_root.rb', line 22

def tag_name
  host.tag_name
end

#text(type = nil, normalize_ws: false) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/capybara/node/shadow_root.rb', line 8

def text(type = nil, normalize_ws: false)
  case base.class.to_s
  when "Capybara::Selenium::SafariNode", "Capybara::Cuprite::Node"
    all("*")
      .select { |node| node.send(:parent).nil? }
      .map { |node| node.text(type, normalize_ws: normalize_ws) }
      .join
  else # For Selenium + Chrome and Selenium + Edge:
    all("*")
      .map { |node| node.text(type, normalize_ws: normalize_ws) }
      .join
  end
end