I\'m using Rspec and Capybara.
How can I write a step to check a checkbox? I\'ve tried check by value but it can\'t find my checkbox<
Had some issues with custom checkbox which is hidden behind label element. Needed a allow_label_click: true.
With reference to this blog post,
check 'checkbox[name]', allow_label_click: true
For cases where there is a link in your label like "I agree to terms and conditions", the above code will open the page, which is not what you want.
Do this instead.
find(:css, "#checkbox_id", visible: false).execute_script('this.checked = true')