Capybara testing value of hidden field

Misha M picture Misha M · Jan 2, 2013 · Viewed 12.3k times · Source

I have a form with a hidden field that contains the current date.

I'm trying to figure out how to write a capybara finder to:

  1. Check that the field is there
  2. Check the value of the field

Is this possible with Capybara?

Answer

Dominik Goltermann picture Dominik Goltermann · Oct 4, 2013

just do this:

find("#id_of_hidden_input", :visible => false).value