# File lib/capybara/driver/celerity_driver.rb, line 7 def [](name) value = if name.to_sym == :class node.class_name else node.send(name.to_sym) end return value if value and not value.to_s.empty? end
# File lib/capybara/driver/celerity_driver.rb, line 52 def click node.click end
# File lib/capybara/driver/celerity_driver.rb, line 56 def drag_to(element) node.fire_event('mousedown') element.node.fire_event('mousemove') element.node.fire_event('mouseup') end
# File lib/capybara/driver/celerity_driver.rb, line 72 def path node.xpath end
# File lib/capybara/driver/celerity_driver.rb, line 28 def select(option) node.select(option) rescue options = all(:xpath, "//option").map { |o| "'#{o.text}'" }.join(', ') raise Capybara::OptionNotFound, "No such option '#{option}' in this select box. Available options: #{options}" end
# File lib/capybara/driver/celerity_driver.rb, line 24 def set(value) node.set(value) end
# File lib/capybara/driver/celerity_driver.rb, line 62 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
# File lib/capybara/driver/celerity_driver.rb, line 3 def text node.text end
# File lib/capybara/driver/celerity_driver.rb, line 76 def trigger(event) node.fire_event(event.to_s) end
# File lib/capybara/driver/celerity_driver.rb, line 35 def unselect(option) unless node.multiple? raise Capybara::UnselectNotAllowed, "Cannot unselect option '#{option}' from single select box." end # FIXME: couldn't find a clean way to unselect, so clear and reselect selected_options = node.selected_options if unselect_option = selected_options.detect { |value| value == option } || selected_options.detect { |value| value.index(option) } node.clear (selected_options - [unselect_option]).each { |value| node.select_value(value) } else options = all(:xpath, "//option").map { |o| "'#{o.text}'" }.join(', ') raise Capybara::OptionNotFound, "No such option '#{option}' in this select box. Available options: #{options}" end end
Generated with the Darkfish Rdoc Generator 2.