teamcapybara/capybara · error · ArgumentError
The :from option does not take an element
Error message
The :from option does not take an element
What it means
Error "The :from option does not take an element" thrown in teamcapybara/capybara.
Source
Thrown at lib/capybara/node/actions.rb:202
# If `from` option is present, {#select} finds a select box, or text input with associated datalist,
# on the page and selects a particular option from it.
# Otherwise it finds an option inside current scope and selects it.
# If the select box is a multiple select, {#select} can be called multiple times to select more than
# one option.
# The select box can be found via its name, id, {Capybara.configure test_id} attribute, or label text.
# The option can be found by its text.
#
# page.select 'March', from: 'Month'
#
# @overload select(value = nil, from: nil, **options)
# @macro waiting_behavior
#
# @param value [String] Which option to select
# @param from [String] The id, {Capybara.configure test_id} attribute, name or label of the select box
#
# @return [Capybara::Node::Element] The option element selected
def select(value = nil, from: nil, **options)
raise ArgumentError, 'The :from option does not take an element' if from.is_a? Capybara::Node::Element
el = from ? find_select_or_datalist_input(from, options) : self
if el.respond_to?(:tag_name) && (el.tag_name == 'input')
select_datalist_option(el, value)
else
el.find(:option, value, **options).select_option
end
end
##
#
# Find a select box on the page and unselect a particular option from it. If the select
# box is a multiple select, {#unselect} can be called multiple times to unselect more than
# one option. The select box can be found via its name, id, {Capybara.configure test_id} attribute,
# or label text.
#
# page.unselect 'March', from: 'Month'View on GitHub (pinned to 15b5fdb76e)
When it happens
Trigger: Thrown at lib/capybara/node/actions.rb:202 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/c48da3abcec4d2eb.
Report an issue: GitHub.