Class: Webrat::Locators::FieldByIdLocator

Inherits:
Locator show all
Defined in:
lib/webrat/core/locators/field_by_id_locator.rb

Overview

:nodoc:

Instance Method Summary collapse

Methods inherited from Locator

#initialize, #locate!

Constructor Details

This class inherits a constructor from Webrat::Locators::Locator

Instance Method Details

#error_messageObject


26
27
28
# File 'lib/webrat/core/locators/field_by_id_locator.rb', line 26

def error_message
  "Could not find field with id #{@value.inspect}"
end

#field_elementObject


12
13
14
15
16
17
18
19
20
# File 'lib/webrat/core/locators/field_by_id_locator.rb', line 12

def field_element
  field_elements.detect do |field_element|
    if @value.is_a?(Regexp)
      field_element["id"] =~ @value
    else
      field_element["id"] == @value.to_s
    end
  end
end

#field_elementsObject


22
23
24
# File 'lib/webrat/core/locators/field_by_id_locator.rb', line 22

def field_elements
  @dom.xpath(*Field.xpath_search)
end

#locateObject


8
9
10
# File 'lib/webrat/core/locators/field_by_id_locator.rb', line 8

def locate
  Field.load(@session, field_element)
end