class Capybara::RackTest::Form
def params(button)
def params(button) form_element_types = %i[input select textarea button] form_elements_xpath = XPath.generate do |xp| xpath = xp.descendant(*form_element_types).where(!xp.attr(:form)) xpath += xp.anywhere(*form_element_types).where(xp.attr(:form) == native[:id]) if native[:id] xpath.where(!xp.attr(:disabled)) end.to_s form_elements = native.xpath(form_elements_xpath).reject { |el| submitter?(el) && (el != button.native) } form_params = form_elements.each_with_object({}.compare_by_identity) do |field, params| case field.name when 'input', 'button' then add_input_param(field, params) when 'select' then add_select_param(field, params) when 'textarea' then add_textarea_param(field, params) end end form_params.each_with_object(make_params) do |(name, value), params| merge_param!(params, name, value) end.to_params_hash # form_elements.each_with_object(make_params) do |field, params| # case field.name # when 'input', 'button' then add_input_param(field, params) # when 'select' then add_select_param(field, params) # when 'textarea' then add_textarea_param(field, params) # end # end.to_params_hash end