Masatoshi Nishiguchi
Masatoshi Nishiguchi's Blog

Masatoshi Nishiguchi's Blog

Capybara clicking icon links

Masatoshi Nishiguchi's photo
Masatoshi Nishiguchi
·Jul 20, 2016·

1 min read

This is a note about how to simulate the click on an icon link in Capybara code.

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

A: title attribute

click_link 'Send email'

B: find by CSS (such as data attribute, id or class)

find(".email-link").click

Resources

 
Share this