[英]Capybara “check()” not checking field
I have the following form element 我有以下表单元素
<div class="control-group no-margin">
<div class="controls">
<label for="user_terms_and_conditions" class="checkbox">
<input id="user_terms_and_conditions" name="user[terms_and_conditions]" type="checkbox" > I accept the Open Vault <a href="/blog/terms-and-conditions">Terms & Conditions</a>
</label>
</div>
</div>
but my capybara test is not properly checking the checkbox with the following 但是我的水豚测试未正确选中以下复选框
check 'user_terms_and_conditions' unless terms_and_conditions.nil?
or 要么
find('#user_terms_and_conditions').set(true) unless terms_and_conditions.nil?
What am I doing wrong? 我究竟做错了什么? There is a validation in the model to make sure its true and it keeps returning the error that this must be checked.
模型中存在一个验证,以确保其正确,并不断返回必须检查的错误。 When i do this with my eyeballs in the browser it works fine.
当我用浏览器的眼球这样做时,它可以正常工作。
Turns out switching from selenium to webkit for the default_driver was all it needed to work. 事实证明,从硒切换到webkit是default_driver所需的全部工作。 For some reason selenium didn't like checking checkboxes in my environment.
由于某种原因,硒不喜欢在我的环境中选中复选框。 I suppose I should have just used webkit from the start.
我想我应该从一开始就使用webkit。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.