Search code examples
htmlrspeccapybara

How to check whether the check box is checked or not capybara Rspec


CHECK

<div class="checkbox">
    <input id="yes_1212" class="check_uncheck" type="checkbox" value="true" name="yes" checked="checked">
    <label></label>
    </div>

UNCHECK

 <div class="checkbox ">
    <input id="allow__100" class="check_uncheck" type="checkbox" value="false" name="Allow">
    <label></label>
    </div>

how to check whether the check box is checked or not


Solution

  • <input id="allow__100" class="check_uncheck" type="checkbox" value="false" name="Allow">    
    

    For input type checkbox

     page.find(:css,
                          "input#allow__100", visible: false
                        ).should_not be_checked