有一个产品列表(html 表)。每行都有产品名称,并以“添加到购物车”按钮结尾。如何在 webrat 的购物车中添加 2 个“咖啡”和 3 个“茶”?
对应的html:
<tr class="odd">
<td><img src="/images/menu_items_images/7/PICT0020_thumb.jpg" /></td>
<td>cofee</td>
<td>americano</td>
<td>1.0</td>
<td><form action="/cart/add_item/7" method="post" onsubmit="$.ajax({data:$.param($(this).serializeArray()) + '&authenticity_token=' + encodeURIComponent('rDzsxOQSgwTT3rjUDROFGNz4hMs6BK0riGemVi+NHK4='), dataType:'script', type:'post', url:'/cart/add_item/7'}); return false;"><div style="margin:0;padding:0;display:inline"><input name="authenticity_token" type="hidden" value="rDzsxOQSgwTT3rjUDROFGNz4hMs6BK0riGemVi+NHK4=" /></div> <input name="commit" type="submit" value="Add to cart" /></form></td>
</tr>
<tr class="even">
<td><img src="/images/menu_items_images/6/PICT0053_thumb.JPG" /></td>
<td>tea</td>
<td>green</td>
<td>2.0</td>
<td><form action="/cart/add_item/6" method="post" onsubmit="$.ajax({data:$.param($(this).serializeArray()) + '&authenticity_token=' + encodeURIComponent('rDzsxOQSgwTT3rjUDROFGNz4hMs6BK0riGemVi+NHK4='), dataType:'script', type:'post', url:'/cart/add_item/6'}); return false;"><div style="margin:0;padding:0;display:inline"><input name="authenticity_token" type="hidden" value="rDzsxOQSgwTT3rjUDROFGNz4hMs6BK0riGemVi+NHK4=" /></div> <input name="commit" type="submit" value="Add to cart" /></form></td>
</tr>