Capybara: Unable to find css

前端 未结 6 1248
被撕碎了的回忆
被撕碎了的回忆 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:33

    Try to add :visible option set to false.

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

    By default Capybara finds only visible elements. It seems that underlying driver identified this input as invisible so it hasn't been found by Capybara.

    :visible option is also supported by most of other Capybara methods (like check, has_css?, have_selector, etc.)

提交回复
热议问题