我有一组使用 bootstrap 的单选按钮,并希望使用 Capybara 使用 id 或 value 来选择它们。对于我的 rspec 测试。由于某种原因,它没有看到单选按钮,我想知道是否有人可以看看并提出一些建议。
我得到的错误是
Capybara::ElementNotFound:无法找到未禁用的可见单选按钮“paper” Capybara::ElementNotFound:无法找到未禁用的可见单选按钮“#paper”
HTML`
</label>
<label for="paper" id="paper" class="btn btn-primary choice col-lg-4 col-md-4">
<input type="radio" value = "paper" name="rps" id="paper">
<img class="card-img-top img-fluid image-responsive" src="/img/paper.png" alt="Paper">
</input>
</label>
<label for="scissors" class="btn btn-primary choice col-lg-4 col-md-4">
<input type="radio" value = "scissors" name="rps" id="scissors">
<img class="card-img-top img-fluid image-responsive" src="/img/scissors.png" alt="Scissors">
</input>
</label>
</div>`
Run Code Online (Sandbox Code Playgroud)
测试
feature 'Testing if we divert to /result chosing an option and play' do
scenario 'Choose option and …Run Code Online (Sandbox Code Playgroud)