teamcapybara/capybara · error · ArgumentError
The RackTest driver does not support click options
Error message
The RackTest driver does not support click options
What it means
rack_test performs clicks purely via DOM semantics (follow links, submit forms, toggle checkboxes/labels/details) - there is no rendering engine to apply coordinates or modifier keys. Node#click silently strips :offset, but any modifier key or remaining option raises ArgumentError. This is a capability guard, not a transient failure.
Source
Thrown at lib/capybara/rack_test/node.rb:63
end
end
def select_option
return if disabled?
deselect_options unless select_node.multiple?
native['selected'] = 'selected'
end
def unselect_option
raise Capybara::UnselectNotAllowed, 'Cannot unselect option from single select box.' unless select_node.multiple?
native.remove_attribute('selected')
end
def click(keys = [], **options)
options.delete(:offset)
raise ArgumentError, 'The RackTest driver does not support click options' unless keys.empty? && options.empty?
if link?
follow_link
elsif submits?
associated_form = form
Capybara::RackTest::Form.new(driver, associated_form).submit(self) if associated_form
elsif checkable?
set(!checked?)
elsif tag_name == 'label'
click_label
elsif (details = native.xpath('.//ancestor-or-self::details').last)
toggle_details(details)
end
end
def tag_name
native.node_name
endView on GitHub (pinned to 15b5fdb76e)
Solutions
- Remove keys/options from the click call for specs that run under rack_test.
- Tag the spec js: true and run it under selenium/cuprite so modifiers and offsets work.
- Branch on driver in shared helpers: plain click for :rack_test, enriched click otherwise.
- For keyboard-driven UI, drive the underlying DOM effect directly (check a box, follow the link) rather than simulating chords.
Example fix
# before
find('a.external').click(:ctrl, :shift) # runs under rack_test
# after
find('a.external').click if Capybara.current_driver == :rack_test
find('a.external').click(:ctrl, :shift) if Capybara.current_driver != :rack_test Defensive patterns
Strategy: validation
Validate before calling
def rack_test_safe_click?(keys, options) Capybara.current_driver == :rack_test ? keys.empty? && options.except(:offset).empty? : true end
Type guard
def enhanced_click_supported? Capybara.current_driver != :rack_test end
Prevention
- Keep modifier-key/coordinate clicks inside specs tagged for a JS driver; plain click under rack_test.
- In shared step definitions, branch on Capybara.current_driver instead of passing options unconditionally.
When it happens
Trigger: find('.row').click(:ctrl); el.click(x: 10, y: 10) (offset is dropped, but x:/y: outside :offset raise - here :offset is the deleted key, so passing x:/y: still raises); find('a').click(:shift, :meta); shared interaction steps run under the default :rack_test driver.
Common situations: A suite mixes rack_test (default) and selenium (js: true) specs, and modifier-key clicks written for selenium leak into untagged specs; row-activation interactions that in the real app are JS click handlers, which rack_test cannot execute anyway.
Related errors
- redirected more than #{driver.redirect_limit} times, check f
- rack-test requires a rack application, but none was given
- This driver doesn't support case insensitive attribute match
- The rack_test driver does not process CSS
- Value cannot be an Array when 'multiple' attribute is not pr
AI-assisted analysis of teamcapybara/capybara@15b5fdb76e (2026-08-21).
Data as JSON: /api/errors/eb0f665757df8084.
Report an issue: GitHub.