Capybara: How do I fill in a input field by its ID
I have this:
<input class="string optional"
id="course_group_courses_attributes_2_name"
name="course_group[courses_attributes][2][name]"
placeholder="Lengua"
size="15"
type="text" />
</div>
How do I fill in a that field by its ID?
fill_in
accepts the id as first parameter:
fill_in 'course_group_courses_attributes_2_name', :with => 'some text'
You can also do it with:
find('Id or class here').set('some text')
fill_in
accepts id without the # symbol which I found confusing at first. Also note that if your input field is in a modal, you may need to wait for the transition or fade in before the field can be filled in.