Method: Capybara::Node::Matchers#has_field?
- Defined in:
- lib/capybara/node/matchers.rb
#has_field?(locator = nil, **options, &optional_filter_block) ⇒ Boolean
Checks if the page or current node has a form field with the given label, name or id.
For text fields and other textual fields, such as textareas and
HTML5 email/url/etc. fields, it's possible to specify a :with
option to specify the text the field should contain:
page.has_field?('Name', with: 'Jonas')
It is also possible to filter by the field type attribute:
page.has_field?('Email', type: 'email')
NOTE: 'textarea' and 'select' are valid type values, matching the associated tag names.
421 422 423 |
# File 'lib/capybara/node/matchers.rb', line 421 def has_field?(locator = nil, **, &optional_filter_block) has_selector?(:field, locator, **, &optional_filter_block) end |