class Capybara::RackTest::Form
def params(button)
def params(button) params = make_params form_element_types = %i[input select textarea] form_elements_xpath = XPath.generate do |x| xpath = x.descendant(*form_element_types).where(!x.attr(:form)) xpath += x.anywhere(*form_element_types).where(x.attr(:form) == native[:id]) if native[:id] xpath.where(!x.attr(:disabled)) end.to_s native.xpath(form_elements_xpath).map do |field| case field.name when 'input' add_input_param(field, params) when 'select' add_select_param(field, params) when 'textarea' add_textarea_param(field, params) end end merge_param!(params, button[:name], button[:value] || "") if button[:name] params.to_params_hash end