cucumber/webrat field issue

This may be a bit off topic but when running my cucumber tests for clearance, webrat said it cannot find the password confirmation field.

Could not find field: "Confirm password" (Webrat::NotFoundError) (eval):2:in `fill_in' ./features/step_definitions/web_steps.rb:34:in `/^(?:|I )fill in "([^ \"]*)" with "([^\"]*)"$/' features/clearance_features/sign_up.feature:19:in `And I fill in "Confirm password" with "password"'

It find all the other fields on the page but not sure why it cannot find this one. it is there. Ideas?

Case issue: Confirm Password is what is actually on the page?

When I have problems with tools that parse web pages, my first attack is to load the page in a browser and view the HTML source. It's usually some silly typo.

It appears to be looking for the actual text on the page because it finds the other fields that is what text is on the page. It should work as this stuff is generated from the cucmber/generator with clearance.

Here is the page source:


  <fieldset class="inputs"><ol>
	<li class="string required" id="user_first_name_input"><label for="user_first_name">First name<abbr title="required">*</abbr></label><input id="user_first_name" maxlength="64" name="user[first_name]" size="50" type="text" /></li>

	<li class="string required" id="user_last_name_input"><label for="user_last_name">Last name<abbr title="required">*</abbr></label><input id="user_last_name" maxlength="64" name="user[last_name]" size="50" type="text" /></li>

  <li class="string required" id="user_email_input"><label for="user_email">Email<abbr title="required">*</abbr></label><input id="user_email" maxlength="255" name="user[email]" size="50" type="text" /></li>

  <li class="password required" id="user_password_input"><label for="user_password">Password<abbr title="required">*</abbr></label><input id="user_password" name="user[password]" size="50" type="password" /></li>

<li class="password required" id="user_password_confirmation_input"><label for="user_password_confirmation">Confirm password<abbr title="required">*</abbr></label><input id="user_password_confirmation" name="user[password_confirmation]" size="50" type="password" /></li>

</ol></fieldset>

You should read the docs a little more closely. Your label isn't "Confirm password" because it includes the abbr tag ... so probably you want to look for the id user_password_confirmation ...Webrat will match on label, id, or name of the field, although I've found sometimes its easier to write my own rules to match on what I want, even if it means dropping down to nokogiri and pulling the element I want directly.

Not my label. Clearance put the all of the cucumber stuff in not me.