Method: Capybara::Queries::SelectorQuery#initialize
- Defined in:
- lib/capybara/queries/selector_query.rb
#initialize(*args, session_options:, enable_aria_label: session_options.enable_aria_label, enable_aria_role: session_options.enable_aria_role, test_id: session_options.test_id, selector_format: nil, order: nil, **options, &filter_block) ⇒ SelectorQuery
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of SelectorQuery.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/capybara/queries/selector_query.rb', line 15 def initialize(*args, session_options:, enable_aria_label: .enable_aria_label, enable_aria_role: .enable_aria_role, test_id: .test_id, selector_format: nil, order: nil, **, &filter_block) @resolved_node = nil @resolved_count = 0 @options = .dup @order = order @filter_cache = Hash.new { |hsh, key| hsh[key] = {} } if @options[:text].is_a?(Regexp) && [true, false].include?(@options[:exact_text]) Capybara::Helpers.warn( "Boolean 'exact_text' option is not supported when 'text' option is a Regexp - ignoring" ) end super(@options) self. = @selector = Selector.new( find_selector(args[0].is_a?(Symbol) ? args.shift : args[0]), config: { enable_aria_label: enable_aria_label, enable_aria_role: enable_aria_role, test_id: test_id }, format: selector_format ) @locator = args.shift @filter_block = filter_block raise ArgumentError, "Unused parameters passed to #{self.class.name} : #{args}" unless args.empty? @expression = selector.call(@locator, **@options) warn_exact_usage assert_valid_keys end |