teamcapybara/capybara · error · Capybara::ReadOnlyElementError

Attempt to set readonly element with value: #{value}

Error message

Attempt to set readonly element with value: #{value}

What it means

Error "Attempt to set readonly element with value: #{value}" thrown in teamcapybara/capybara.

Source

Thrown at lib/capybara/node/element.rb:119

      ##
      #
      # @return [String]    The value of the form element
      #
      def value
        synchronize { base.value }
      end

      ##
      #
      # 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. Take default values from {Capybara.configure default_set_options}.
      #
      # @return [Capybara::Node::Element]  The element
      def set(value, **options)
        if ENV.fetch('CAPYBARA_THOROUGH', nil) && readonly?
          raise Capybara::ReadOnlyElementError, "Attempt to set readonly element with value: #{value}"
        end

        options = session_options.default_set_options.to_h.merge(options)
        synchronize { base.set(value, **options) }
        self
      end

      ##
      #
      # Select this node if it is an option element inside a select tag.
      #
      # @!macro action_waiting_behavior
      #   If the driver dynamic pages (JS) and the element is currently non-interactable, this method will
      #   continuously retry the action until either the element becomes interactable or the maximum
      #   wait time expires.
      #
      #   @param [false, Numeric] wait
      #     Maximum time to wait for the action to succeed. Defaults to {Capybara.configure default_max_wait_time}.

View on GitHub (pinned to 15b5fdb76e)

When it happens

Trigger: Thrown at lib/capybara/node/element.rb:119 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/f793588fb687562e. Report an issue: GitHub.