Class: PageMagic::Element::Query::SingleResult

Inherits:
PageMagic::Element::Query show all
Defined in:
lib/page_magic/element/query/single_result.rb

Overview

class SingleResult - use to query when only one result should be expected

Constant Summary

Constants inherited from PageMagic::Element::Query

DEFAULT_DECORATOR

Instance Attribute Summary

Attributes inherited from PageMagic::Element::Query

#options, #selector_args

Instance Method Summary collapse

Methods inherited from PageMagic::Element::Query

#==, #execute, #initialize

Constructor Details

This class inherits a constructor from PageMagic::Element::Query

Instance Method Details

#find(capybara_element, &block) ⇒ Object

Find an element The supplied block will be used to decorate the results

Parameters:

  • capybara_element (Capybara::Node::Element)

    the element to be searched within

Returns:



12
13
14
15
16
# File 'lib/page_magic/element/query/single_result.rb', line 12

def find(capybara_element, &block)
  block.call capybara_element.find(*selector_args, **options)
rescue Capybara::Ambiguous => e
  raise AmbiguousQueryException, e.message
end