假设我有这样的 HTML:
<div class="out-radio">
<div class="in-radio">
<input type="radio" value = "12345">
<label
<span
<div
<img src="http://s3.amazonaws.com/test001.jpg">
</div>
</span
</label
</div>
<div class="in-radio">
<input type="radio" value = "12346">
<label
<span
<div
<img src="http://s3.amazonaws.com/test002.jpg">
</div>
</span
</label
</div>
<div class="in-radio">
<input type="radio" value = "12347">
<label
<span
<div
<img src="http://s3.amazonaws.com/test003.jpg">
</div>
</span
</label
</div>
<div class="in-radio">
<input type="radio" value = "12348">
<label
<span
<div
<img src="http://s3.amazonaws.com/test004.jpg">
</div>
</span
</label
</div>
<div class="in-radio">
<input type="radio" value = "12349">
<label
<span
<div
<img src="http://s3.amazonaws.com/test005.jpg">
</div>
</span
</label
</div>
</div>
如果我想显示value
所选单选按钮,我会这样做:
browser.element(:xpath, '//*[@class = "in-radio"]').inputs.each {|input| puts value if input.checked?}
我将如何显示src
所选单选按钮?有什么办法可以说:
browser.element(:xpath, '//*[@class = "in-radio"]').(inputs,imgs).each {|input,img| ...}