Capybara: Unable to find css

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

    Hard to tell without seeing the whole HTML page. Here are some possible problems:

    1. You may be looking for the checkbox before the page is fully loaded? Make sure you have enough wait time before calling find(#agreement)
    2. You may have multiple tags with the same id="agreement". Make sure you only have one.
    3. Make sure the page is valid HTML.
    4. Make sure the checkbox is visible, and enabled, and agreeValidate() is working properly.

提交回复
热议问题