Class: Capybara::Selector::Filters::LocatorFilter

Inherits:
NodeFilter show all
Defined in:
lib/capybara/selector/filters/locator_filter.rb

Instance Method Summary collapse

Methods inherited from Base

#boolean?, #default, #default?, #format, #handles_option?, #matcher?, #skip?

Constructor Details

#initialize(block, **options) ⇒ LocatorFilter

Returns a new instance of LocatorFilter.



9
10
11
# File 'lib/capybara/selector/filters/locator_filter.rb', line 9

def initialize(block, **options)
  super(nil, nil, block, **options)
end

Instance Method Details

#matches?(node, value, context = nil, exact:) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
16
17
# File 'lib/capybara/selector/filters/locator_filter.rb', line 13

def matches?(node, value, context = nil, exact:)
  apply(node, value, true, context, exact: exact, format: context&.default_format)
rescue Capybara::ElementNotFound
  false
end