Reputation: 1485
For my integration test of editing a record, I try to replace the existing text in a form input field with a new text:
find("input[@id='course_title']").set("a safer workplace")
However,everytime I check the page with
save_and_open_page
the text in the input field is not replaced with the new test.
how can I replace the text value of an input field a new text value in Capybara?
Thanks for your help,
Anthony
Upvotes: 7
Views: 6386
Reputation: 5847
There are several ways to do this, try one of these:
fill_in('course_title', :with => 'a safer workplace') find("input#course_title]").set("a safer workplace") find(:xpath, "//input[@id='course_title']").set("a safer workplace")
Upvotes: 3