Is there a way to have rspec click a specific font awesome icon? I'm very new to rspec so I apologize if this is a very basic question.
I tried click_link '.fa-envelope'
but it seems like that is looking for the name of the link.
Any ideas?
EDIT:
Here's the html of the link I'm trying to click:
<div class="col-sm-4 align-center">
<a class="email-link" href="/contact"><i class="fa fa-envelope"></i></a>
</div>
You also can use title attribute :
<div class="col-sm-4 align-center">
<a class="email-link" href="/contact" title="Send email"><i class="fa fa-envelope"></i></a>
</div>
Then in your feature spec you can write :
click_link 'Send email'
Hope this helped !
Assuming you use capybara so you can use finders instead:
find(".email-link").find(".fa-envelope").click
http://rubydoc.info/github/jnicklas/capybara/master/Capybara/Node/Finders
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