Capybara: Unable to find css

前端 未结 6 1222
被撕碎了的回忆
被撕碎了的回忆 2021-01-03 18:16

I am using capybara to click a checkbox, however it can\'t seem to find it no matter what I do. I am able to correctly find both the span and the label inside the span, but

6条回答
  •  鱼传尺愫
    2021-01-03 18:34

    I had the exact issue yesterday. Capybara was automatically ignoring the input due to it being invisible. I solved it with the following:

    find('#agreement', :visible => false).click
    

    You can also add the following to env.rb to enable Capybara to interact with all hidden elements:

    Capybara.ignore_hidden_elements = false
    

提交回复
热议问题