ruby on rails - Find and fill in input field by data attribute -
i want find elements "test" info attribute , fill them in following:
when(/^i sign in valid credentials$/) email = page.find("data-test='email'") password = page.find("data-test='password'") fill_in email, with: @user.email fill_in password, with: @user.password submit = page.find("[data-test='submit']") submit.click end
the button works fine, inputs throw next error:
unable find field #<capybara::element tag="input"> (capybara::elementnotfound)
is there way in capybara? in advance help.
fill_in
method accepts element's id, name or label text, might not work result find method returns. in case seek set
method:
find("input[data-test='email']").set(@user.email)
ruby-on-rails rspec capybara
No comments:
Post a Comment