Class: Chop::Form::FieldFinder

Inherits:
Object
  • Object
show all
Defined in:
lib/chop/form.rb

Instance Method Summary collapse

Constructor Details

#initialize(session, css_selector) ⇒ FieldFinder

Returns a new instance of FieldFinder.



48
49
50
51
# File 'lib/chop/form.rb', line 48

def initialize(session, css_selector)
  @session = session
  @css_selector = css_selector
end

Instance Method Details

#find(locator) ⇒ Object



53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/chop/form.rb', line 53

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