I cannot get Capybara to fill in the values ββin my login field. Here login_spec.rb
require 'spec_helper' describe "the login process" do it "signs me in" do visit '/login' fill_in 'user_username', :with => 'Admin' fill_in 'user_password', :with => 'Password' end end
When I run the test, it fails with the following error:
1) the login process signs me in Failure/Error: fill_in 'user_username', :with => 'Admin' Capybara::ElementNotFound: no text field, text area or password field with id, name, or label 'user_username' found
But when I print the contents of the page with
print page.html
I clearly see that the item identifiers are correct.
<h2>Already Have an Account?</h2> <form accept-charset="UTF-8" action="/login" id="sidebar_login" method="post"> <div style="margin:0;padding:0;display:inline"> <input name="utf8" type="hidden" value="β"><input name="authenticity_token" type="hidden" value="DccrBxhdS7WTAM/iEd08L4z9zt8MjBKTxQ0s6lMVIAA="> </div> <div class="form"></div> <div class="login_form_widget"> Username <div class="inputdiv_widget"> <input class="textfield" id="user_username" name="user[username]" type="text"> </div> Password <div class="inputdiv_widget"> <input class="textfield" id="user_password" name="user[password]" type="password"> </div>
I tried using the item id (user_username) and name (user [username]), all with the same results. Is something missing here?
source share