Class: Chop::Form::FieldFinder
- Inherits:
-
Object
- Object
- Chop::Form::FieldFinder
- Defined in:
- lib/chop/form.rb
Instance Method Summary collapse
- #find(locator) ⇒ Object
-
#initialize(session, css_selector) ⇒ FieldFinder
constructor
A new instance of FieldFinder.
Constructor Details
#initialize(session, css_selector) ⇒ FieldFinder
Returns a new instance of FieldFinder.
40 41 42 43 |
# File 'lib/chop/form.rb', line 40 def initialize(session, css_selector) @session = session @css_selector = css_selector end |
Instance Method Details
#find(locator) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/chop/form.rb', line 45 def find(locator) return nil if locator.nil? @locator = locator.to_s @all_fields = @session.all(@css_selector) find_by_direct_attributes || find_by_aria_label || find_by_associated_label || find_by_wrapping_label || raise_not_found end |