<div id="look_here">
<a href="stackoverflow.com"><img src="xxxxxxxxxx.xxx"></a>
</div>
Capybara(およびRSpec)でこのリンクをどのようにテストしますか?
画像は動的に生成されるので、でテストしたいと思いhref
ます。
<div id="look_here">
<a href="stackoverflow.com"><img src="xxxxxxxxxx.xxx"></a>
</div>
Capybara(およびRSpec)でこのリンクをどのようにテストしますか?
画像は動的に生成されるので、でテストしたいと思いhref
ます。
これは機能するはずです:
page.should have_xpath("//a[@href='stackoverflow.com']")
page.should have_selector "a[href='stackoverflow.com']"
http://www.w3.org/TR/CSS2/selector.htmlのセクション5.8.1マッチング属性と属性値を参照してください。