Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails: Filling in a dynamic field using capybara

I have a text field that is dynamically created via javascript with the long id:

user_user_skills_attributes_69878013874980_skill_title

where the 69878013874980 is a generated timestamp.

How do I fill in the field with this id in a capybara test?

Thanks

like image 438
GTDev Avatar asked Nov 11 '12 23:11

GTDev


1 Answers

You can use the set command. Something like:

find(:css, "input[id^='user_user_skills_attributes_'][id$='_skill_title']").set("This is a test title")
like image 67
mccannf Avatar answered Nov 15 '22 23:11

mccannf