Method: Capybara::Node::Actions#unselect
- Defined in:
- lib/capybara/node/actions.rb
#unselect(value = nil, from: nil, **options) ⇒ Capybara::Node::Element
Find a select box on the page and unselect a particular option from it. If the select box is a multiple select, #unselect can be called multiple times to unselect more than one option. The select box can be found via its name, id, test_id attribute, or label text.
page.unselect 'March', from: 'Month'
230 231 232 233 234 235 |
# File 'lib/capybara/node/actions.rb', line 230 def unselect(value = nil, from: nil, **) raise ArgumentError, 'The :from option does not take an element' if from.is_a? ::Node::Element scope = from ? find(:select, from, **) : self scope.find(:option, value, **).unselect_option end |