Class: Webrat::Link

Inherits:
Element show all
Defined in:
lib/webrat/core/elements/link.rb

Overview

:nodoc:

Instance Attribute Summary

Attributes inherited from Element

#element

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Element

#initialize, #inspect, load, load_all, #path

Constructor Details

This class inherits a constructor from Webrat::Element

Class Method Details

.xpath_searchObject



9
10
11
# File 'lib/webrat/core/elements/link.rb', line 9

def self.xpath_search
  [".//a[@href]"]
end

Instance Method Details

#click(options = {}) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/webrat/core/elements/link.rb', line 13

def click(options = {})
  method = options[:method] || http_method
  return if href =~ /^#/ && method == :get

  options[:javascript] = true if options[:javascript].nil?

  if options[:javascript]
    @session.request_page(absolute_href, method, data)
  else
    @session.request_page(absolute_href, :get, {})
  end
end