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
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")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With