I try couple way but just not working.
<input class="" placeholder="Email" type="email" value="" name="user[email]" id="user_email">
all of these not working
fill_in "user_email", with: user.email
fill_in :placeholder => 'Email', :with => user.email
fill_in :name => "user[email]", with: user.email
fill_in("Email", options = {:placeholder => 'Email', :with => 'John'})
fill_in("Email", options = {:id => 'user_email', :with => 'John'})
Full RSpec:
require 'rails_helper'
describe "Sign up", :type => :feature do
it "should work" do
user = build(:user)
visit '/'
# fill_in "user_email", with: user.email
# fill_in :placeholder => 'Email', :with => user.email
# fill_in :name => "user[email]", with: user.email
# fill_in("Email", options = {:placeholder => 'Email', :with => 'John'})
fill_in("Email", options = {:id => 'user_email', :with => 'John'})
# fill_in("Email", options = {placeholder('Email'), :with => 'John'})
# fill_in :placeholder => "Email", :with => user.email
# fill_in :name => "Username", with: user.username
fill_in "Password", with: user.password
check "I agree"
click_on 'Sign up'
expect(page).to have_content(user.username)
end
end
Google Search Result about "Capybara placeholder" are all from 2013 or before.
After I read document I still don't know how..
http://www.rubydoc.info/github/jnicklas/capybara/master/Capybara/Node/Actions#fill_in-instance_method
Maybe you guys can put some example here?
https://github.com/jnicklas/capybara#interacting-with-forms
:ice_cream: :
Thank you
What do you mean by "not working"? Do you get an error, does it just not fill in, etc? What driver are you using? What version of Capybara are you using?
@twalpole
Thank for reply!,
Sorry for incomplete information.
Problem already solved, I just give up on using placeholder, Just use the ID of the element
fill_in "user_email", with: user.email
fill_in "user_username", with: user.username
fill_in "user_password", with: user.password
This work for me
one of my html
<input placeholder="Password" type="password" name="user[password]" id="user_password">
Thanks again
have a nice day :D
Ok
fill_in 'Email', with: user.email
should have worked too
Most helpful comment
Ok
should have worked too