小编I D*_*ani的帖子

使用水豚选择引导单选按钮

我有一组使用 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)

html rspec capybara

2
推荐指数
1
解决办法
1258
查看次数

标签 统计

capybara ×1

html ×1

rspec ×1