Can I unchoose a radio button like you uncheck a checkbox?
I'm running a test where I'm going down different "branches" of a survey and I've come across this need. Thanks.
While there doesn't appear to be an unchoose
method in Capybara (which is curious given select
& check
both have corresponding "un" versions), given the code for choose
, this should work:
def unchoose(locator)
msg = "cannot choose field, no radio button with id, name, or label '#{locator}' found"
find(:xpath, XPath::HTML.radio_button(locator), :message => msg).set(false)
end