2
比方說,我有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| ...}
的HTML是不是非常好,我來編輯它把它放在公衆。 – user2134050 2013-05-03 21:00:04