Masatoshi Nishiguchi
Software Engineer

Capybara - clicking icon links

rspec capybara
<div class="col-sm-4 align-center">
  <a class="email-link" href="/contact" title="Send email">
    <i class="fa fa-envelope"></i>
  </a>
</div>

We can use title attribute:

click_link 'Send email'

We can use finders:

find(".email-link").click

References