Class: Webrat::Locators::FieldNamedLocator
- Inherits:
-
Locator
show all
- Defined in:
- lib/webrat/core/locators/field_named_locator.rb
Overview
Instance Method Summary
collapse
Methods inherited from Locator
#initialize, #locate!
Instance Method Details
#error_message ⇒ Object
30
31
32
|
# File 'lib/webrat/core/locators/field_named_locator.rb', line 30
def error_message
"Could not find field named #{@value.inspect}"
end
|
#field_element ⇒ Object
12
13
14
15
16
|
# File 'lib/webrat/core/locators/field_named_locator.rb', line 12
def field_element
field_elements.detect do |field_element|
Webrat::XML.attribute(field_element, "name") == @value.to_s
end
end
|
#field_elements ⇒ Object
18
19
20
|
# File 'lib/webrat/core/locators/field_named_locator.rb', line 18
def field_elements
Webrat::XML.xpath_search(@dom, *xpath_searches)
end
|
8
9
10
|
# File 'lib/webrat/core/locators/field_named_locator.rb', line 8
def locate
Field.load(@session, field_element)
end
|
#xpath_searches ⇒ Object
22
23
24
25
26
27
28
|
# File 'lib/webrat/core/locators/field_named_locator.rb', line 22
def xpath_searches
if @field_types.any?
@field_types.map { |field_type| field_type.xpath_search }.flatten
else
Array(Field.xpath_search)
end
end
|