Clicking on image as link using Capybara in Cucumber tests‏

There seems to be a lot of convoluted way of doing this. But after some research, it turns out click_link method does have ability to click image links found by alt.

If you had some Haml code like below you wanted to test …

=link_to image_tag('logo.png', :alt => 'rhapsody-logo'), 'http://www.rhapsody.com'

In order to click this logo image link with Capybara …

click_link(image_alt_value)

This was posted 8 months ago. It has 0 notes.