在动态网页上,我不知道预先匹配元素的数量,所以我不知道要使用哪个索引 #。
watir-webdriver 是否提供了一种访问 LAST 匹配元素的方法,而不是默认情况下首先访问?
有问题的 HTML 形成了一个日历控件
<table border="0" class="body-style">
<tbody>
<tr>
<td width="27" align="right"><b>Sun</b></td>
<td width="27" align="right"><b>Mon</b></td>
<td width="27" align="right"><b>Tue</b></td>
<td width="27" align="right"><b>Wed</b></td>
<td width="27" align="right"><b>Thu</b></td>
<td width="27" align="right"><b>Fri</b></td>
<td width="27" align="right"><b>Sat</b></td></tr>
<tr>
<td align="right"><p class="end-of-weekday-style">Â 1Â </p></td>
<td align="right"><p class="end-of-weekday-style">Â 2Â </p></td>
<td align="right"><p class="end-of-weekday-style">Â 3Â </p></td>
<td align="right"><p class="end-of-weekday-style">Â 4Â </p></td>
<td align="right"><p class="end-of-weekday-style">Â 5Â </p></td>
<td align="right"><p class="end-of-weekday-style">Â 6Â </p></td>
<td align="right"><p class="end-of-weekday-style">Â 7Â </p></td></tr>
<tr>
<td align="right"><p class="end-of-weekday-style">Â 8Â </p></td>
<td align="right"><p class="end-of-weekday-style">Â 9Â </p></td>
<td align="right"><p class="end-of-weekday-style">Â 10Â </p></td>
<td align="right"><p class="end-of-weekday-style">Â 11Â </p></td>
<td align="right"><p class="end-of-weekday-style">Â 12Â </p></td>
<td align="right"><a class="current-day-style selected-day-style" onmousemove="window.status=" "" onmouseout="window.status=" "" title="" href="javascript:dateSelected=13;closeCalendar();doOtherFunctions();">Â 13Â </a></td>
<td align="right"><p class="end-of-weekday-style">Â 14Â </p></td></tr>
<tr>
<td align="right"><p class="end-of-weekday-style">Â 15Â </p></td>
<td align="right"><a class="normal-day-style" onmousemove="window.status=" "" onmouseout="window.status=" "" title="" href="javascript:dateSelected=16;closeCalendar();doOtherFunctions();">Â 16Â </a></td>
<td align="right"><a class="normal-day-style" onmousemove="window.status=" "" onmouseout="window.status=" "" title="" href="javascript:dateSelected=17;closeCalendar();doOtherFunctions();">Â 17Â </a></td>
<td align="right"><a class="normal-day-style" onmousemove="window.status=" "" onmouseout="window.status=" "" title="" href="javascript:dateSelected=18;closeCalendar();doOtherFunctions();">Â 18Â </a></td>
<td align="right"><a class="normal-day-style" onmousemove="window.status=" "" onmouseout="window.status=" "" title="" href="javascript:dateSelected=19;closeCalendar();doOtherFunctions();">Â 19Â </a></td>
<td align="right"><a class="normal-day-style" onmousemove="window.status=" "" onmouseout="window.status=" "" title="" href="javascript:dateSelected=20;closeCalendar();doOtherFunctions();">Â 20Â </a></td>
<td align="right"><p class="end-of-weekday-style">Â 21Â </p></td></tr>
<tr>
<td align="right"><p class="end-of-weekday-style">Â 22Â </p></td>
<td align="right"><a class="normal-day-style" onmousemove="window.status=" "" onmouseout="window.status=" "" title="" href="javascript:dateSelected=23;closeCalendar();doOtherFunctions();">Â 23Â </a></td>
<td align="right"><a class="normal-day-style" onmousemove="window.status=" "" onmouseout="window.status=" "" title="" href="javascript:dateSelected=24;closeCalendar();doOtherFunctions();">Â 24Â </a></td>
<td align="right"><a class="normal-day-style" onmousemove="window.status=" "" onmouseout="window.status=" "" title="" href="javascript:dateSelected=25;closeCalendar();doOtherFunctions();">Â 25Â </a></td>
<td align="right"><a class="normal-day-style" onmousemove="window.status=" "" onmouseout="window.status=" "" title="" href="javascript:dateSelected=26;closeCalendar();doOtherFunctions();">Â 26Â </a></td>
<td align="right"><a class="normal-day-style" onmousemove="window.status=" "" onmouseout="window.status=" "" title="" href="javascript:dateSelected=27;closeCalendar();doOtherFunctions();">Â 27Â </a></td>
<td align="right"><p class="end-of-weekday-style">Â 28Â </p></td></tr>
<tr>
<td align="right"><p class="end-of-weekday-style">Â 29Â </p></td>
<td align="right"><a class="normal-day-style" onmousemove="window.status=" "" onmouseout="window.status=" "" title="" href="javascript:dateSelected=30;closeCalendar();doOtherFunctions();">Â 30Â </a></td>
<td align="right"><a class="normal-day-style" onmousemove="window.status=" "" onmouseout="window.status=" "" title="" href="javascript:dateSelected=31;closeCalendar();doOtherFunctions();">Â 31Â </a></td></tr>
</tbody>
</table>