Class: Capybara::Driver::SafariWatir::Node

Inherits:
Struct
  • Object
show all
Defined in:
lib/capybara/driver/safariwatir_driver.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nodeObject

Returns the value of attribute node

Returns:

  • (Object)

    the current value of node



4
5
6
# File 'lib/capybara/driver/safariwatir_driver.rb', line 4

def node
  @node
end

Instance Method Details

#attribute(name) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/capybara/driver/safariwatir_driver.rb', line 9

def attribute(name)
  value = if name.to_sym == :class
    node.class_name
  else
    node.send(name.to_sym)
  end
  return value if value and not value.empty?
end

#clickObject



18
19
20
# File 'lib/capybara/driver/safariwatir_driver.rb', line 18

def click
  node.click
end

#tag_nameObject



22
23
24
25
26
# File 'lib/capybara/driver/safariwatir_driver.rb', line 22

def tag_name
  # FIXME: this might be the dumbest way ever of getting the tag name
  # there has to be something better...
  node.to_xml[/^\s*<([a-z0-9\-\:]+)/, 1]
end

#textObject



5
6
7
# File 'lib/capybara/driver/safariwatir_driver.rb', line 5

def text
  node.text
end