如何使用Poltergeist选择Capybara的单选按钮?

时间:2014-09-30 16:46:37

标签: capybara poltergeist

HTML:

<div id='survey'>
  Name:<input type='text' name='name'><br>
  Like sushi?<input type="radio" name="sushi" value="yes">Yes 
             <input type="radio" name="sushi" value="no">No
</div>

规格:

within 'div#survey' do
  fill_in 'name', with:'Joe Brown'
  choose 'no'
end

这引发了例外:

 Failure/Error: choose 'no'
 Capybara::ElementNotFound:
   Unable to find radio button "no"

如何选择单选按钮“否”?

1 个答案:

答案 0 :(得分:1)

尝试选择“否”,因为标签文字为大写字母。