2012-08-16 77 views
0
<div id="look_here"> 
    <a href="stackoverflow.com"><img src="xxxxxxxxxx.xxx"></a> 
</div> 

如何测试水豚(和RSpec)中的此链接?如何测试与水豚链接的http ref

该图像是动态生成的,所以我只想测试href

回答

1

这应该工作:

page.should have_xpath("//a[@href='stackoverflow.com']")