Reputation: 45941
<div id="look_here">
<a href="stackoverflow.com"><img src="xxxxxxxxxx.xxx"></a>
</div>
How would you test for this link in Capybara (and RSpec)?
The image is dynamically generated, so I just want to test by href
.
Upvotes: 0
Views: 106
Reputation: 45941
page.should have_selector "a[href='stackoverflow.com']"
See Section 5.8.1 Matching attributes and attribute values on http://www.w3.org/TR/CSS2/selector.html
Upvotes: 1
Reputation: 4515
This should work:
page.should have_xpath("//a[@href='stackoverflow.com']")
Upvotes: 1