我如何在水豚中单击此按钮 [英] How do i click this button in capybara

查看:72
本文介绍了我如何在水豚中单击此按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮助我用水豚解决这个问题

Please help me solve this problem with capybara

在水豚中我有一个类似的按钮:

I have a button like this in capybara:

<input type="submit" value="Verify" name="verify" id="verify" class="button">

我尝试过

click_button验证

但它给出了错误:

Failure/Error: find('#verify').click
NoMethodError:
  undefined method `node_name' for nil:NilClass


推荐答案

作者的答案



问题出在html代码内部:

Answer by the author

The problem lies inside the html code:

<div>
<form>
<div>    
</div>
</div>
  <input type="submit" value="Verify" name="verify" id="verify" class="button">
</form>

因为有一个多余的< / div> < input> 在表格外被处理,因此 capybara 导致这些错误。删除多余的< / div> 之后,一切正常。

Because there is one redundant </div>, the <input> was treat outside the form, hence capybara cause those error. After delete the redundant </div>, everything works fine.

这篇关于我如何在水豚中单击此按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆