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



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

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

Instance Method Details

#click(options = {}) ⇒ Object



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

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