teamcapybara/capybara · error · ArgumentError

Value cannot be an Array when 'multiple' attribute is not pr

Error message

Value cannot be an Array when 'multiple' attribute is not present. Not a #{value.class}

What it means

Error "Value cannot be an Array when 'multiple' attribute is not present. Not a #{value.class}" thrown in teamcapybara/capybara.

Source

Thrown at lib/capybara/selenium/node.rb:61

  ##
  #
  # Set the value of the form element to the given value.
  #
  # @param [String] value    The new value
  # @param [Hash{}] options  Driver specific options for how to set the value
  # @option options [Symbol,Array] :clear (nil) The method used to clear the previous value <br/>
  #   nil => clear via javascript <br/>
  #   :none =>  append the new value to the existing value <br/>
  #   :backspace => send backspace keystrokes to clear the field <br/>
  #   Array => an array of keys to send before the value being set, e.g. [[:command, 'a'], :backspace]
  # @option options [Boolean] :rapid (nil) Whether setting text inputs should use a faster &quot;rapid&quot; mode<br/>
  #   nil => Text inputs with length greater than 30 characters will be set using a faster driver script mode<br/>
  #   true => Rapid mode will be used regardless of input length<br/>
  #   false => Sends keys via conventional mode. This may be required to avoid losing key-presses if you have certain
  #            Javascript interactions on form inputs<br/>
  def set(value, **options)
    if value.is_a?(Array) && !multiple?
      raise ArgumentError, "Value cannot be an Array when 'multiple' attribute is not present. Not a #{value.class}"
    end

    tag_name, type = attrs(:tagName, :type).map { |val| val&.downcase }
    @tag_name ||= tag_name

    case tag_name
    when 'input'
      case type
      when 'radio'
        click
      when 'checkbox'
        click if value ^ checked?
      when 'file'
        set_file(value)
      when 'date'
        set_date(value)
      when 'time'
        set_time(value)

View on GitHub (pinned to 15b5fdb76e)

When it happens

Trigger: Thrown at lib/capybara/selenium/node.rb:61 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of teamcapybara/capybara@15b5fdb76e (2026-08-21). Data as JSON: /api/errors/9560ed7a26738591. Report an issue: GitHub.