Posted 16 days ago. Visible to the public.

Capybara: How to find a hidden field by its label

To find an input with the type hidden, you need to specify the type hidden:

Copy
find_field('Some label', type: :hidden)

Otherwise you will see an exception :

Copy
find_field('Some label') # => Capybara::ElementNotFound: Unable to find field "Some label" that is not disabled`.

Note: Usually you don't need to check the input of hidden fields in an integration test. But e.g. waiting for a datepicker library to write the expected value to this field before continuing the test, which prevents flaky tests, is a valid use case.

Does your version of Ruby on Rails still receive security updates?
Rails LTS provides security patches for old versions of Ruby on Rails (3.2 and 2.3).

Owner of this card:

Avatar
Emanuel De
Last edit:
4 days ago
by Niklas Hasselmeyer
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Emanuel De to makandra dev
This website uses cookies to improve usability and analyze traffic.
Accept or learn more