Method: Capybara::Node::Finders#find
- Defined in:
- lib/capybara/node/finders.rb
#find(*args, **options, &optional_filter_block) ⇒ Capybara::Node::Element
Find an Element based on the given arguments. #find will raise an error if the element is not found.
page.find('#foo').find('.bar')
page.find(:xpath, './/div[contains(., "bar")]')
page.find('li', text: 'Quox').click_link('Delete')
If the driver is capable of executing JavaScript, this method will wait for a set amount of time and continuously retry finding the element until either the element is found or the time expires. The length of time this method will wait is controlled through default_max_wait_time.
51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/capybara/node/finders.rb', line 51 def find(*args, **, &optional_filter_block) [:session_options] = = .slice(*Capybara::Queries::BaseQuery::COUNT_KEYS) unless .empty? Capybara::Helpers.warn( "'find' does not support count options (#{}) ignoring. " \ "Called from: #{Capybara::Helpers.filter_backtrace(caller)}" ) end synced_resolve Capybara::Queries::SelectorQuery.new(*args, **, &optional_filter_block) end |