class Capybara::Node::Simple

def value

Returns:
  • (String) - The value of the form element
def value
  if tag_name == 'textarea'
    native['_capybara_raw_value']
  elsif tag_name == 'select'
    selected_options = find_xpath('.//option[@selected]')
    if multiple?
      selected_options.map(&method(:option_value))
    else
      option_value(selected_options.first || find_xpath('.//option').first)
    end
  elsif tag_name == 'input' && %w[radio checkbox].include?(native[:type])
    native[:value] || 'on'
  else
    native[:value]
  end
end