class Capybara::Email::Node

Public Instance Methods

[](name) click to toggle source
# File lib/capybara/email/node.rb, line 6
def [](name)
  string_node[name]
end
all_text() click to toggle source
# File lib/capybara/email/node.rb, line 18
def all_text
  normalize_whitespace(text)
end
click(_keys=[], _options={}) click to toggle source
# File lib/capybara/email/node.rb, line 22
def click(_keys=[], _options={})
  driver.follow(self[:href].to_s)
end
disabled?() click to toggle source
# File lib/capybara/email/node.rb, line 34
def disabled?
  string_node.disabled?
end
find(locator) click to toggle source
# File lib/capybara/email/node.rb, line 38
def find(locator)
  native.xpath(locator).map { |node| self.class.new(driver, node) }
end
Also aliased as: find_xpath
find_xpath(locator)
Alias for: find
tag_name() click to toggle source
# File lib/capybara/email/node.rb, line 26
def tag_name
  native.node_name
end
text() click to toggle source
# File lib/capybara/email/node.rb, line 2
def text
  native.text
end
value() click to toggle source
# File lib/capybara/email/node.rb, line 10
def value
  string_node.value
end
visible?() click to toggle source
# File lib/capybara/email/node.rb, line 30
def visible?
  string_node.visible?
end
visible_text() click to toggle source
# File lib/capybara/email/node.rb, line 14
def visible_text
  normalize_whitespace(unnormalized_text)
end

Protected Instance Methods

unnormalized_text() click to toggle source
# File lib/capybara/email/node.rb, line 45
def unnormalized_text
  if !visible?
    ''
  elsif native.text?
    native.text
  elsif native.element?
    native.children.map do |child|
      Capybara::Email::Node.new(driver, child).unnormalized_text
    end.join
  else
    ''
  end
end

Private Instance Methods

normalize_whitespace(text) click to toggle source
# File lib/capybara/email/node.rb, line 61
def normalize_whitespace(text)
  text.to_s.gsub(/[[:space:]]+/, ' ').strip
end
string_node() click to toggle source
# File lib/capybara/email/node.rb, line 65
def string_node
  @string_node ||= Capybara::Node::Simple.new(native)
end