Trying to fill in a text input in cucumber using webrat with
When I fill in "Last name" with "Doe"
given this HTML
<label>
<span>Last name</span>
<input class="title" id="user_last_name" name="user[last_name]" size="30" type="text" />
<small>Some hint text here</small>
</label>
will throw an Webrat::NotFoundError
error for the input element.
If I remove the < small >
tag, the field is found just fine.
Is this a bug? Is there a workaround existing?
That's not so pretty HTML. It should be this:
<p>
<label for='user_last_name'>Last Name</label>
<input id='user_last_name' [ other stuff]>
<small>Some hint text here</small>
</p>
Or in ActionView terms:
<p>
<%= f.label :last_name %>
<%= f.text_field :last_name %>
<small>Some hint text here</small>
</p>