Capybara: won't select bootstrap button group Capybara: won't select bootstrap button group selenium selenium

Capybara: won't select bootstrap button group


I found the solution, because input tags aren't closed I need to use Capybara and find the tags.

The following code was able to work:

page.find('label', text: 'Stocky body').click

Hope this helps anyone else trying to use Capybara with Bootstrap-styled selectors!


Isn't click_button a function? So use click_button('Stocky body') in stead. And then "Stocky body" is not a button. At least not one as specified by html.

Also, your html is mall-formatted potentially causing a problem with your xpath. Your input tags are not closed.


FWIW, most likely to future me, one reason Capybara's choose may not be working is because your labels aren't inline.

In my case with Capybara, Simple Form, and Bootstrap this post describes the problem and solution