How to obtain the value of a checkbox in capybara?

Use the checked? method

e.g.:

my_box = find('#some_checkbox')
my_box.should be_checked  # Before Rspec 2.11

# OR using new syntax
expect(my_box).to be_checked  # Rspec 2.11

Leave a Comment