Class: Webrat::Locators::LabelLocator
- Inherits:
-
Locator
show all
- Defined in:
- lib/webrat/core/locators/label_locator.rb
Overview
Instance Method Summary
collapse
Methods inherited from Locator
#initialize, #locate!
Instance Method Details
#label_element ⇒ Object
13
14
15
16
17
|
# File 'lib/webrat/core/locators/label_locator.rb', line 13
def label_element
label_elements.detect do |label_element|
text(label_element) =~ /^\W*#{Regexp.escape(@value.to_s)}(\b|\Z)/i
end
end
|
9
10
11
|
# File 'lib/webrat/core/locators/label_locator.rb', line 9
def locate
Label.load(@session, label_element)
end
|
#text(label_element) ⇒ Object
23
24
25
26
27
28
29
|
# File 'lib/webrat/core/locators/label_locator.rb', line 23
def text(label_element)
str = Webrat::XML.all_inner_text(label_element)
str.gsub!("\n","")
str.strip!
str.squeeze!(" ")
str
end
|