Method: Capybara::Node::Matchers#has_select?
- Defined in:
- lib/capybara/node/matchers.rb
#has_select?(locator = nil, **options, &optional_filter_block) ⇒ Boolean
Checks if the page or current node has a select field with the given label, name or id.
It can be specified which option should currently be selected:
page.has_select?('Language', selected: 'German')
For multiple select boxes, several options may be specified:
page.has_select?('Language', selected: ['English', 'German'])
It's also possible to check if the exact set of options exists for this select box:
page.has_select?('Language', options: ['English', 'German', 'Spanish'])
You can also check for a partial set of options:
page.has_select?('Language', with_options: ['English', 'German'])
520 521 522 |
# File 'lib/capybara/node/matchers.rb', line 520 def has_select?(locator = nil, **, &optional_filter_block) has_selector?(:select, locator, **, &optional_filter_block) end |