I am wondering if I’m missing something or if I’ve found a bug; hoping someone else can help.
I have a number of fields on a form. All the ones that have single word names get found and filled, no problem. All the ones with multiple word names do not. Is this expected behavior?
example:
fill_in "Something", :with=> "value"
works
fill_in "Something Else", :with => "another"
does not
I’ve tried changing it to:
fill_in "something_else", :with => "another"
and that fails too, same message
"cannot fill in, no text field, text area or password field with id, name, or label 'something_else'"
I’m wondering at this point if Capybara is expecting _ to be boundaries and so it can’t find them if they have multiple words like that. Anyone else encounter this problem? Is there a fix?
After tinkering for a while more, I found that the way to do this is to actually pass the full name attribute that you expect to be there (I guess the matcher can’t infer which parts of the spaces are the object name vice the name of the property). It follows the form:
So let’s say you want to fill-in a user registration form, it might be:
given that you previously populated
@password