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.
54 55 56 57 |
# File 'lib/chop/form.rb', line 54 def initialize(session, css_selector) @session = session @css_selector = css_selector end |
Instance Method Details
#find(locator) ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/chop/form.rb', line 59 def find(locator) return nil if locator.nil? @locator = locator.to_s @session.document.synchronize do @all_fields = @session.all(@css_selector, wait: false) find_by_direct_attributes || find_by_aria_label || find_by_associated_label || find_by_wrapping_label || raise_not_found end end |