class Capybara::RackTest::Node
def displayed_text(check_ancestor: true)
- Api: - private
def displayed_text(check_ancestor: true) if !string_node.visible?(check_ancestor) '' elsif native.text? native.text .gsub(/[\u200b\u200e\u200f]/, '') .gsub(/[\ \n\f\t\v\u2028\u2029]+/, ' ') elsif native.element? text = native.children.map do |child| Capybara::RackTest::Node.new(driver, child).displayed_text(check_ancestor: false) end.join || '' text = "\n#{text}\n" if BLOCK_ELEMENTS.include?(tag_name) text else '' end end