Sha256: 0bbbb713af9fc3b8fe30a2a64c1f9c47a7a33dbe1c6581506a61974d3325bd92
Contents?: true
Size: 829 Bytes
Versions: 1
Compression:
Stored size: 829 Bytes
Contents
module Capybara module Searchable def find(locator, options = {}) all(locator, options).first end def find_field(locator) find(XPath.field(locator)) end alias_method :field_labeled, :find_field def find_link(locator) find(XPath.link(locator)) end def find_button(locator) find(XPath.button(locator)) end def find_by_id(id) find(Xpath.for_css("##{id}")) end def all(locator, options = {}) results = all_unfiltered(locator) if options[:text] results = results.select { |n| n.text.match(options[:text]) } end if options[:visible] == true results.reject! { |n| !n.visible? } end results end private def all_unfiltered(locator) raise "Must be overridden" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
capybara-0.3.0 | lib/capybara/searchable.rb |