Module: Capybara::Searchable
Instance Method Summary collapse
- #all(locator, options = {}) ⇒ Object
- #find(locator, options = {}) ⇒ Object
- #find_button(locator) ⇒ Object
- #find_by_id(id) ⇒ Object
- #find_field(locator) ⇒ Object (also: #field_labeled)
- #find_link(locator) ⇒ Object
Instance Method Details
#all(locator, options = {}) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/capybara/searchable.rb', line 24 def all(locator, = {}) results = all_unfiltered(locator) if [:text] results = results.select { |n| n.text.match([:text]) } end if [:visible] == true results.reject! { |n| !n.visible? } end results end |
#find(locator, options = {}) ⇒ Object
3 4 5 |
# File 'lib/capybara/searchable.rb', line 3 def find(locator, = {}) all(locator, ).first end |
#find_button(locator) ⇒ Object
16 17 18 |
# File 'lib/capybara/searchable.rb', line 16 def (locator) find(XPath.(locator)) end |
#find_by_id(id) ⇒ Object
20 21 22 |
# File 'lib/capybara/searchable.rb', line 20 def find_by_id(id) find(Xpath.for_css("##{id}")) end |